Part Number Hot Search : 
ST21Y068 ONDUC FAM1503 PD100F2 4734A H474K 7C102 PL2305
Product Description
Full Text Search
 

To Download T89C51RD2-3CSIM Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  feature summary ? 32-bit load/store risc architecture  up to 15 general-purpose 32-bit registers  32-bit stack pointer, program counter, and link register reside in register file  fully orthogonal instruction set  pipelined architecture allows one instruction per clock cycle for most instructions  byte, half-word, word and double word memory access  fast interrupts and multiple interrupt priority levels  optional branch prediction for minimum delay branches  privileged and unprivileged modes enablin g efficient and secure operating systems  innovative instruction set together with variable instruction length ensuring industry leading code density  optional dsp extention with saturated arithmetic, and a wide variety of multiply instructions  optional extensions for java, simd, read -modify-write to memo ry, and coprocessors  architectural support for effi cient on-chip debug solutions  optional mpu or mmu allows fo r advanced operating systems  flashvault ? support through secure state for executing trusted code alongside nontrusted code on the same cpu 32000d?04/2011 avr32 architecture document
2 32000d?04/2011 avr32 1. introduction avr32 is a new high-performance 32-bit risc microprocessor core, designed for cost-sensitive embedded applications, with particular emphasis on low power consumption and high code den- sity. in addition, the instruction set architecture has been tuned to allow for a variety of microarchitectures, enabling the avr32 to be impl emented as low-, mid- or high-performance processors. avr32 extends the avr family into the world of 32- and 64-bit applications. 1.1 the avr family the avr family was launched by atmel in 1996 and has had remarkable success in the 8-and 16-bit flash microcontroller market. avr32 is complements the current avr microcontrollers. through the avr32 family, the avr is extended into a new range of higher performance appli- cations that is currently served by 32- and 64-bit processors to truly exploit the power of a 32-bit architecture, the new avr32 architecture is not binary com- patible with earlier avr architectures. in order to achieve high code density, the instruction format is flexible providing both compact inst ructions with 16 bits length and extended 32-bit instructions. while the instruction length is only 16 bits for most instructions, powerful 32-bit instructions are implemented to further increase performance. compact and extended instruc- tions can be freely mixed in the instruction stream. 1.2 the avr32 microprocessor architecture the avr32 is a new innovative microprocessor ar chitecture. it is a fully synchronous synthesis- able rtl design with industry standard interfaces, ensuring easy integration into soc designs with legacy intellectual property (ip). through a quantitative approach, a large set of industry recognized benchmarks has been compiled and analyz ed to achieve the best code density in its class of microprocessor architectu res. in addition to lowering the memory requirements, a com- pact code size also contributes to the core?s low power characteristics. the processor supports byte and half-word data types without penalty in code size and performance. memory load and store operations are provided for byte, half-word, word and double word data with automatic sign- or zero extension of half-word and byte data. the c-compiler is closely linked to the architecture and is able to expl oit code optimization features, both for size and speed. in order to reduce code size to a minimum, so me instructions have multiple addressing modes. as an example, instructions with immediates often have a compact format with a smaller imme- diate, and an extended format with a larger immediate. in this way, the compiler is able to use the format giving the smallest code size. another feature of the instruction set is that frequently used instructions, like add, have a com- pact format with two operands as well as an extended format with three operands. the larger format increases performance, allowing an addition and a data move in the same instruction in a single cycle. load and store instructions have several different formats in order to reduce code size and speed up execution:  load/store to an address specified by a pointer register  load/store to an address specified by a pointer register with postincrement
3 32000d?04/2011 avr32  load/store to an address specified by a pointer register with predecrement  load/store to an address specified by a pointer register with displacement  load/store to an address specified by a small immediate (direct addressing within a small page)  load/store to an address specified by a pointer register and an index register. the register file is organized as 16 32-bit regi sters and includes the program counter, the link register, and the stack pointer. in addition, one re gister is designed to hold return values from function calls and is used imp licitly by some instructions. the avr32 core defines several micro architectures in order to capture the entire range of appli- cations. the microarchitectures are named avr32a, avr32b and so on. different microarchitectures are suited to different end applications, allowing the designer to select a microarchitecture with the optimum set of parameters for a specific application. 1.2.1 exceptions and interrupts the avr32 incorporates a powerful excepti on handling scheme. the different exception sources, like illegal op-code and external interrup t requests, have different priority levels, ensur- ing a well-defined behavior when multiple except ions are received simu ltaneously. additionally, pending exceptions of a higher priority class ma y preempt handling of ongoing exceptions of a lower priority class. each priority class has dedicated registers to keep the return address and status register thereby removing the need to perform time-consuming memory operations to save this information. there are four levels of external interrupt r equests, all executing in their own context. the con- texts can provide a number of dedicated registers for the interrupts to use directly ensuring low latency. high priority interrupts may have a larger number of shadow registers available than low priority interrupts. an interrupt controller does the priority handling of the external interrupts and provides the prioritized interrupt vector to the processor core. 1.2.2 java support java hardware acceleration is available as an option, in the form of a java card or java virtual machine hardware implementation. 1.2.3 flashvault revision 3 of the avr32 architecture introduced a new cpu state called secure state. this state is instrumental in the new security technology named flashvault. this innovation allows the on-chip flash and other memories to be partially programmed and locked, creating a safe on- chip storage for secret code and valuable software intellectual property. code stored in the flashvault will execute as normal, but reading, copying or debugging the code is not possible. this allows a device with flashvault code protec tion to carry a piece of valuable software such as a math library or an encryption algorithm from a trusted location to a potentially untrustworthy partner where the rest of the source code can be developed, debugged and programmed.
4 32000d?04/2011 avr32 1.3 microarchitectures the avr32 architecture defines different microarchitectures. this enables implementations that are tailored to specific needs and applications. the microarchitectures provide different perfor- mance levels at the expense of area and power consumption. the following microarchitectures are defined: 1.3.1 avr32a the avr32a microarchitecture is targeted at cost -sensitive, lower-end a pplications like smaller microcontrollers. this microarchitecture does not provide dedicated hardware registers for shad- owing of register file registers in interrupt contexts. additionally, it does not provide hardware registers for the return address registers and return status registers. instead, all this information is stored on the system stack. this saves chip area at the expense of slower interrupt handling. upon interrupt initiation, registers r8-r12 are automatically pushed to the system stack. these registers are pushed regardless of the priority level of the pending interrupt. the return address and status register are also automatically pushed to stack. the interrupt handler can therefore use r8-r12 freely. upon interrupt completion, the old r8-r12 registers and status register are restored, and execution continues at the return address stored popped from stack. the stack is also used to store the status register and return address for exceptions and scall . executing the rete or rets instruction at the completion of an exception or system call will pop this status register and continue execution at the popped return address. 1.3.2 avr32b the avr32b microarchitecture is targeted at applications where interrupt latency is important. the avr32b therefore implements dedicated registers to hold the status register and return address for interrupts, exceptions and supervisor calls. this information does not need to be written to the stack, and latency is therefore reduced. additionally, avr32b allows hardware shadowing of the registers in the register file. the int0 to int3 contexts may have dedicated versions of the registers in the register file, allowing the interrupt routine to start executing immediately. the scall , rete and rets instructions use the dedicated status register and return address regis- ters in their operation. no stack accesses are performed.
5 32000d?04/2011 avr32 2. programming model this chapter describes the programming model and the set of registers accessible to the user. 2.1 data formats the avr32 processor supports the data types shown in table 2-1 on page 5 : when any of these types are described as unsig ned, the n bit data value represents a non-neg- ative integer in the range 0 to + 2 n -1. when any of these types are described as signed, the n bit data value represents an integer in the range of -2 n-1 to +2 n-1 -1, using two?s complement format. some instructions operate on fractional numbers. for these numbers, the data value represents a fraction in the range of -1 to +1-2 -(n-1) , using two?s complement format. 2.2 data organization data is usually stored in a big-endian way, see figure 2-1 on page 5 . this means that when multi-byte data is stored in memory, the most significant byte is stored at the lowest address. all instructions are interpreted as being big-endian. however, in order to support data transfers that are little-endian, special endian-translating load and store instructions are defined. the register file can hold data of different formats. both byte, halfword (16-bit) and word (32-bit) formats can be represented, and byte and halfword formats are supported in both unsigned and signed 2?s complement formats. some instructions also use doubleword operands. doubleword data are placed in two consecutive registers. the most significant word is in the uppermost reg- ister. valid register pairs are r1:r0, r3:r2, r5:r4, r7:r6, r9:r8, r11:r10 and r13:r12. load and store operations that transfer bytes or halfwords, automatically zero-extends or sign- extends the bytes or half-words as they are loaded. figure 2-1. data representation in the register file table 2-1. overview of execution modes, their priorities and pr ivilege levels. type data width byte 8 bits halfword 16 bits word 32 bits double word 64 bits ssssssssssssssssssssssss byte s 70 8 31 000000000000000000000000 byte 70 8 31 ssssssssssssssss 15 0 16 31 halfword s 0000000000000000 15 0 16 31 halfword top upper lo w er bottom 31 0 sign extended byte unsigned byte sign extended halfword unsigned halfword word
6 32000d?04/2011 avr32 avr32 can access data of size byte, halfword, word and doubleword using dedicated instruc- tions. the memory system can support unaligned accesses for selected load/store instructions in some implementations. an y other unaligned access will cause an address exception. for performance reasons, the user should make sure that the stack always is word aligned. this means that only word instructions can be used to access the stack. when manipulating the stack pointer , the user has to ensure that the result is word aligned before trying to load and store data on the stack. failing to do so will result in performance penalties. code will execute correctly if the stack is unaligned but with a significant performance penalty. 2.3 instruction organization the avr32 instruction set has both compact and extended instructions. compact instructions denotes the instructions which have a length of 16 bits while extended instructions have a length of 32 bits. all instructions must be placed on halfword boundaries, see table 2-2 on page 6 . extended instructions can be both aligned and unaligned to halfword boundaries. in normal instruction flow, the instruction buffer will always contain eno ugh entries to ensure that compact, aligned extended and unaligned extended instructions can be issued in a single cycle. change-of-flow operations such as branches, jumps, calls and returns may in some implemen- tations require the instruction buffer to be fl ushed. the user should consult the technical reference manual for the specific implementation in order to determine how alignment of the branch target address affects performance. table 2-2. instructions are stored in memory in a big endian fashion and must be aligned on half word boundaries word address ijn+24 h1 h2 n+20 f2 g n+16 e2 f1 n+12 de1n+8 c1 c2 n+4 abn byte address 0123 byte address 0123
7 32000d?04/2011 avr32 2.4 processor states 2.4.1 normal risc state the avr32 processor supports several diff erent execution contexts as shown in table 2-3 on page 7 . mode changes can be made under software control, or can be caused by external interrupts or exception processing. a mode can be interrupted by a higher priority mode, but never by one with lower priority. nested exceptions can be supported with a minimal software overhead. when running an operating system on the avr32, user processes will typically execute in the application mode. the programs executed in this mode are restricted from executing certain instructions. furthermore, most system registers together with the upper halfword of the status register cannot be accessed. protected memory areas are also not available. all other operating modes are privileged and are collectively called system modes. they have full access to all priv- ileged and unprivileged re sources. after a reset, the proc essor will be in su pervisor mode. 2.4.2 debug state the avr32 can be set in a debug state, which allows implementation of software monitor rou- tines that can read out and alter system information for use during application development. this implies that all system and application regist ers, including the status registers and program counters, are accessible in debug state. th e privileged instructions are also available. all interrupt levels are by default disabled when debug state is entered, but they can individually be switched on by the monitor routine by clearing the respective mask bit in the status register. debug state can be entered as described in the technical reference manual. debug state is exited by the retd instruction. 2.4.3 java state some versions of the avr32 processor core comes with a java extension module (jem). the processor can be set in a java state where normal risc operations are suspended. the java state is described in chapter 3. 2.4.4 secure state the secure state added in the avr32 architecture revision 3 allows executing secure or trusted software in alongside nonsecure or untrusted software on the same processor. hardware mech- table 2-3. overview of execution modes, their priorities and pr ivilege levels. priority mode security description 1 non maskable interrupt privileged non maskable high priority interrupt mode 2 exception privileged execute exceptions 3 interrupt 3 privileged general purpose interrupt mode 4 interrupt 2 privileged general purpose interrupt mode 5 interrupt 1 privileged general purpose interrupt mode 6 interrupt 0 privileged general purpose interrupt mode n/a supervisor privileged runs supervisor calls n/a application unprivileged normal program execution mode
8 32000d?04/2011 avr32 anisms are in place to make sure the nonsecure software can not read or modify instruction or data belonging to the secure software. the secure state is described in chapter 4. 2.5 entry and exit mechanism table 2-4 on page 8 illustrates how the diff erent states and modes are entered and exited. 2.6 register file each of avr32?s normal operation modes described in section 2.4.1 ?normal risc state? on page 7 has a dedicated context. note that the stack pointer (sp), program counter (pc) and the link register (lr) are mapped into the regist er file, making the effective register count for each context 13 general purpose registers. the mapping of sp, pc and lr allows ordinary instructions, like additions or subtractions, to use these registers. this results in efficient addressing of memory. register r12 is designed to hold return values from function calls, and the conditional return with move and test instruction use this register as an implicit return va lue operand. the load mul- tiple and pop multiple instructions have the same functionality, which enables them to be used as return instructions. the avr32 core?s orthogonal instruction set allows all registers in the register file to be used as pointers. 2.6.1 register file in avr32a the avr32a is targeted for cost-sensitive appl ications. therefore, no hardware-shadowing of registers is provided, see figure 2-2 on page 9 . all data that must be saved between execution states are placed on the system stack, not in dedicated registers as do ne in avr32b. a shad- owed stack pointer is still provided for the privileged modes, facilitating a dedicated system stack. when an exception occurs in an avr32a-comp liant implementation, the status register and return address are pushed by hardware onto the system stack. when an int0, int1, int2 or int3 occurs, the status register, return address, r8-r12 and lr are pushed on the system stack. the corresponding registers are popped from stack by the rete instruction. the scall and rets instructions also use the system stack to store the return address and status register. table 2-4. entry and exit from states, modes and functions entry method exit method non-maskable interrupt signal on nmi line rete exception mode internal error signal generated rete interrupt3 signal on int3 line rete interrupt2 signal on int2 line rete interrupt1 signal on int1 line rete interrupt0 signal on int0 line rete supervisor mode scall instruction rets application mode returned to from any of the above modes can not be exited from subprogram function call ret{cond} , ldm , popm , mov pc, lr secure state sscall retss
9 32000d?04/2011 avr32 figure 2-2. register file in avr32a 2.6.2 register file in avr32b the avr32b allows separate register files for the interrupt and exception modes, see figure 2-3 on page 9 . these modes have a number of implementation defined shadowed registers in order to speed up interrupt handling. the shadowed registers are automatically mapped in depending on the current execution mode. all contexts, except application, have a dedi cated return status register (rsr) and return address register (rar). the rsr registers are used for storing the status register value in the context to return to. the rar registers are used for storing the address in the context to return to. the rsr and rar registers eliminates the need to temporarily store the status register and return address to stack when entering a new context. figure 2-3. register file in avr32b the register file is designed with an implementation specific part and an architectural defined part. depending on the implementation, each of the interrupt modes can have different configu- application bit 0 supervisor bit 31 pc sr int0pc fintpc int1pc smpc r7 r5 r6 r4 r3 r1 r2 r0 bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 int0 sp_app sp_sys r12 r11 r9 r10 r8 exception nmi int1 int2 int3 lr lr bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr application bit 0 supervisor bit 31 pc sr int0pc fintpc int1pc smpc r7 r5 r6 r4 r3 r1 r2 r0 bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 int0 bit 0 bit 31 pc rsr_int0 sr sp_app sp_sys sp_sys r12 r11 r9 r10 r8 banked registers (implementation defined) bit 0 bit 31 pc lr / lr_int2 sp_sys banked registers (implementation defined) rsr_int2 sr bit 0 bit 31 pc rsr_int3 lr / lr_int3 sr sp_sys banked registers (implementation defined) bit 0 bit 31 pc sr sp_sys banked registers (implementation defined) rsr_int1 exception bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr rsr_ex nmi bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr rsr_nmi int1 int2 int3 lr lr rsr_sup lr / lr_int0 lr / lr_int1 rar_int0 rar_int2 rar_int3 rar_int1 rar_ex rar_nmi rar_sup
10 32000d?04/2011 avr32 rations of shadowed registers. this allows for ma ximum flexibility in targeting the processor for different application, see figure 2-4 on page 10 . figure 2-4. a typical avr32b register file implementation three different shadowing schemes are offered, small, half and full, ranging from no general registers shadowed to all general registers shadowed, see figure 2-5 on page 10 . figure 2-5. avr32 offers three different models for shadowed registers. 2.7 the stack pointer since the stack pointer (sp) is located in the register file, it can be addressed as an ordinary register. this simplifies allocation and access of local variables and parameters. the stack pointer is also used implicit ly by several instructions. the system modes have a shadowed stack pointer different from the application mode stack pointer. this allows havi ng a separate system stack. application bit 0 supervisor bit 31 pc sr int0pc fintpc int1pc smpc r7 r5 r6 r4 r3 r1 r2 r0 bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 rsr_int0 sr rsr_ex sr sp_app sp_sys rsr_nmi sr r12 r11 r9 r10 r8 bit 0 bit 31 pc lr int0pc fintpc int1pc smpc r7 r5 r6 r4 r3 r1 r2 r0 bit 0 bit 31 pc lr_int2 fintpc smpc r7 r5 r6 r4 r3 r1 r2 r0 bit 0 bit 31 pc lr_int3 r12_int3 int0pc fintpc int1pc smpc r7_int3 r5_int3 r6_int3 r4_int3 r11_int3 r9_int3 r10_int3 r8_int3 r3_int3 r1_int3 r2_int3 r0_int3 sp_sys sp_sys sp_sys r12 r11 r9 r10 r8 r12_int2 r11_int2 r9_int2 r10_int2 r8_int2 bit 0 bit 31 pc lr int0pc fintpc int1pc smpc r7 r5 r6 r4 r3 r1 r2 r0 sp_sys r12 r11 r9 r10 r8 bit 0 bit 31 pc lr int0pc fintpc int1pc smpc r7 r5 r6 r4 r3 r1 r2 r0 sp_sys r12 r11 r9 r10 r8 bit 0 bit 31 pc lr int0pc fintpc int1pc smpc r7 r5 r6 r4 r3 r1 r2 r0 sp_sys r12 r11 r9 r10 r8 rsr_int1 sr rsr_int2 sr rsr_int3 sr int0 int1 int2 int3 exception nmi rsr_sup lr lr rar_int0 rar_ex rar_nmi rar_int1 rar_int2 rar_int3 rar_sup small bit 0 bit 31 pc lr int0pc fintpc int1pc smpc r7 r5 r6 r4 r3 r1 r2 r0 half bit 0 bit 31 pc lr_intx fintpc smpc r7 r5 r6 r4 r3 r1 r2 r0 full bit 0 bit 31 pc lr_intx r12_intx int0pc fintpc int1pc smpc r7_intx r5_intx r6_intx r4_intx r11_intx r9_intx r10_intx r8_intx r3_intx r1_intx r2_intx r0_intx sp_sys sp_sys sp_sys r12 r11 r9 r10 r8 r12_intx r11_intx r9_intx r10_intx r8_intx
11 32000d?04/2011 avr32 2.8 the program counter the program counter (pc) contains the address of the instruction being executed. the memory space is byte addressed. with the exception of java state, the instruction size is a multiple of 2 bytes and the lsb of the program counter is fixed to zero. the pc is automatically incremented in normal program flow, depending on the size of the current instruction. the pc is mapped into the register file and it can be used as a source or destination operand in all instructions using register operands. this includes arithmetical or logical instructions and load/store instructions. instructions using pc as destination register are treated the same way as jump instructions. this implies that the pipeline is flushed, and execution resumed at the address specified by the new pc value. 2.9 the link register the general purpose register r14 is used as a li nk register in all modes. the link register holds subroutine return addresses. when a subrout ine call is performed by a variant of the call instruction, lr is set to hold the subroutine return address. the subroutine return is performed by copying lr back to the program counter, either explicitly by a mov instruction, by using a ldm or popm instruction or a ret instruction. the link register r14 can be used as a general-purpose register at all other times. 2.10 the status register the status register (sr) is split into two halfwords, one upper and one lower, see figure 2-6 on page 11 and figure 2-7 on page 12 . the lower halfword contains the c, z, n, v and q flags, while the upper halfword contains information about the mode and state the processor executes in. the upper halfword can only be accessed from a privileged mode. figure 2-6. the status register high halfword bit 31 0 0 0 bit 16 interrupt level 0 mask interrupt level 1 mask interrupt level 3 mask interrupt level 2 mask 1 0 0 0 0 1 1 0 0 0 0 0 0 secure state fe i0m gm m1 j d m0 em i2m dm - m2 lc 1 ss initial value bit name i1m mode bit 0 mode bit 1 h mode bit 2 reserved debug state - i3m java state exception mask global interrupt mask debug state mask java handle reserved
12 32000d?04/2011 avr32 figure 2-7. the status regist er low halfword ss - secure state this bit is indicates if the processor is executing in the secure state. for more details, see chap- ter 4. the bit is initialized in an implementation defined way at reset. h - java handle this bit is included to support different heap types in the java virtual machine. for more details, see chapter 3. the bit is cleared at reset. j - java state the processor is in java state when this bi t is set. the incoming instruction stream will be decoded as a stream of java bytecodes, not risc opcodes. the bit is cleared at reset. this bit should not be modified by the user as undefined behaviour may result. dm - debug state mask if this bit is set, the debug state is masked and cannot be entered. the bit is cleared at reset, and can both be read and written by software. d - debug state the processor is in debug state when this bit is set. the bit is cleared at reset and should only be modified by debug hardware, the breakpoint instruction or the retd instruction. undefined behav- iour may result if the user trie s to modify this bit manually. m2, m1, m0 - execution mode these bits show the active ex ecution mode. the settings for the different modes are shown in table 2-5 on page 13 . m2 and m1 are cleared by reset while m0 is set so that the processor is in supervisor mode after reset. these bits are m odified by hardware, or execution of certain instructions like scall , rets and rete . undefined behaviour may result if the user tries to modify these bits manually. bit 15 bit 0 reserved c arry zero sign 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - - - - t r bit name in itia l va lu e 0 0 l q v n z c - overflow s a tu ra tio n - - - lock register rem ap enable scratch
13 32000d?04/2011 avr32 em - exception mask when this bit is set, exceptions are masked. exce ptions are enabled otherwise. the bit is auto- matically set when exception processing is initiated or debug mode is entered. software may clear this bit after performing the necessary meas ures if nested exceptions should be supported. this bit is set at reset. i3m - interrupt level 3 mask when this bit is set, level 3 interrupts are masked. if i3m and gm are cleared, int3 interrupts are enabled. the bit is automatically set when in t3 processing is initiated. software may clear this bit after performing the necessary measures if nested int3s should be supported. this bit is cleared at reset. i2m - interrupt level 2 mask when this bit is set, level 2 interrupts are masked. if i2m and gm are cleared, int2 interrupts are enabled. the bit is automatically set when in t3 or int2 processing is initiated. software may clear this bit after performing the necessary measures if nested int2s should be supported. this bit is cleared at reset. i1m - interrupt level 1 mask when this bit is set, level 1 interrupts are masked. if i1m and gm are cleared, int1 interrupts are enabled. the bit is automatically set when int3 , int2 or int1 processing is initiated. soft- ware may clear this bit after performing the necessary measures if nested int1s should be supported. this bit is cleared at reset. i0m - interrupt level 0 mask when this bit is set, level 0 interrupts are masked. if i0m and gm are cleared, int0 interrupts are enabled. the bit is automatically set when int3, int2, int1 or int0 processing is initiated. software may clear this bit after performing t he necessary measures if nested int0s should be supported. this bit is cleared at reset. gm - global interrupt mask when this bit is set, all interrupts are disabled. this bit overrides i0m, i1m, i2m and i3m. the bit is automatically set when exception processing is initiated, debug mode is entered, or a java trap is taken. this bit is automatically cleared when returning from a java trap. this bit is set after reset. table 2-5. mode bit settings m2 m1 m0 mode 1 1 1 non maskable interrupt 1 1 0 exception 1 0 1 interrupt level 3 1 0 0 interrupt level 2 0 1 1 interrupt level 1 0 1 0 interrupt level 0 0 0 1 supervisor 0 0 0 application
14 32000d?04/2011 avr32 r - java register remap when this bit is set, the addresses of the registers in the register file is dynamically changed. this allows efficient use of the register file registers as a stack. for more details, see chapter 3.. the r bit is cleared at reset. undefined behaviour ma y result if this bit is modified by the user. t - scratch bit this bit is not set or cleared implicit by any instruction and the programmer can therefore use this bit as a custom flag to for example signal even ts in the program. this bit is cleared at reset. l - lock flag used by the conditional store in struction. used to support atomical memory access. automati- cally cleared by rete . this bit is cleared after reset. q - saturation flag the saturation flag indicates that a saturating arithmetic operation overflowed. the flag is sticky and once set it has to be manually cleared by a csrf instruction after the desired action has been taken. see the instruction set description for details. v - overflow flag the overflow flag indicates that an arithmetic operation overflowed. see the instruction set description for details. n - negative flag the negative flag is modified by arithmetical and logical operations. see the instruction set description for details. z - zero flag the zero flag indicates a zero result after an arithmetic or logic operation. see the instruction set description for details. c - carry flag the carry flag indicates a carry after an arithmetic or logic operation. see the instruction set description for details. 2.11 system registers the system registers are placed outside of the virtual memory space, and are only accessible using the privileged mfsr and mtsr instructions, see table 2-7 on page 15 . the number of physi- cal locations is implementation defined, but a maximum of 256 locations can be addressed with the dedicated instructions. some of the system registers are altered automati- cally by hardware. the reset value of the system registers are implementation defined.
15 32000d?04/2011 avr32 the compliance column describes if the register is required, optional or unused in avr32a and avr32b, see table 2-6 on page 15 for legend. table 2-6. legend for the compliance column abbreviation meaning ra required in avr32a oa optional in avr32a ua unused in avr32a rb required in avr32b ob optional in avr32b ub unused in avr32b table 2-7. system registers reg # address name function compliance 0 0 sr status register ra rb 1 4 evba exception vector base address ra rb 2 8 acba application call base address ra rb 3 12 cpucr cpu control register ra rb 4 16 ecr exception cause register oa ob 5 20 rsr_sup return status register for supervisor context ua rb 6 24 rsr_int0 return status register for int 0 context ua rb 7 28 rsr_int1 return status register for int 1 context ua rb 8 32 rsr_int2 return status register for int 2 context ua rb 9 36 rsr_int3 return status register for int 3 context ua rb 10 40 rsr_ex return status register for exception context ua rb 11 44 rsr_nmi return status register for nmi context ua rb 12 48 rsr_dbg return status register for debug mode oa ob 13 52 rar_sup return address register for supervisor context ua rb 14 56 rar_int0 return address register for int 0 context ua rb 15 60 rar_int1 return address register for int 1 context ua rb 16 64 rar_int2 return address register for int 2 context ua rb 17 68 rar_int3 return address register for int 3 context ua rb 18 72 rar_ex return address register for exception context ua rb 19 76 rar_nmi return address register for nmi context ua rb 20 80 rar_dbg return address register for debug mode oa ob 21 84 jecr java exception cause register oa ob 22 88 josp java operand stack pointer oa ob 23 92 java_lv0 java local variable 0 oa ob
16 32000d?04/2011 avr32 24 96 java_lv1 java local variable 1 oa ob 25 100 java_lv2 java local variable 2 oa ob 26 104 java_lv3 java local variable 3 oa ob 27 108 java_lv4 java local variable 4 oa ob 28 112 java_lv5 java local variable 5 oa ob 29 116 java_lv6 java local variable 6 oa ob 30 120 java_lv7 java local variable 7 oa ob 31 124 jtba java trap base address oa ob 32 128 jbcr java write barrier control register oa ob 33-63 132-252 reserved reserved for future use - - 64 256 config0 configuration register 0 ra rb 65 260 config1 configuration register 1 ra rb 66 264 count cycle counter register ra rb 67 268 compare compare register ra rb 68 272 tlbehi mmu tlb entry high oa ob 69 276 tlbelo mmu tlb entry low oa ob 70 280 ptbr mmu page table base register oa ob 71 284 tlbear mmu tlb exception address register oa ob 72 288 mmucr mmu control register oa ob 73 292 tlbarlo mmu tlb accessed register low oa ob 74 296 tlbarhi mmu tlb accessed register high oa ob 75 300 pccnt performance clock counter oa ob 76 304 pcnt0 performance counter 0 oa ob 77 308 pcnt1 performance counter 1 oa ob 78 312 pccr performance counter control register oa ob 79 316 bear bus error address register oa ob 80 320 mpuar0 mpu address register region 0 oa ob 81 324 mpuar1 mpu address register region 1 oa ob 82 328 mpuar2 mpu address register region 2 oa ob 83 332 mpuar3 mpu address register region 3 oa ob 84 336 mpuar4 mpu address register region 4 oa ob 85 340 mpuar5 mpu address register region 5 oa ob 86 344 mpuar6 mpu address register region 6 oa ob 87 348 mpuar7 mpu address register region 7 oa ob 88 352 mpupsr0 mpu privilege select register region 0 oa ob 89 356 mpupsr1 mpu privilege select register region 1 oa ob table 2-7. system registers (continued) reg # address name function compliance
17 32000d?04/2011 avr32 sr- status register the status register is mapped into the system regi ster space. this allows it to be loaded into the register file to be modified, or to be stored to memory. the status register is described in detail in section 2.10 ?the status register? on page 11 . evba - exception vector base address this register contains a pointer to the excepti on routines. all exception routines start at this address, or at a defined offset relative to the address. special alignment requirements may apply for evba, depending on the implementation of the interrup t controller. exceptions are described in detail in section 8. ?event processing? on page 63 . acba - application call base address pointer to the start of a table of function pointers. subroutines can thereby be called by the com- pact acall instruction. this facilitates efficient reuse of code. keeping this pointer as a register facilitates multiple function pointer tables. acba is a full 32 bit register, but the lowest two bits 90 360 mpupsr2 mpu privilege select register region 2 oa ob 91 364 mpupsr3 mpu privilege select register region 3 oa ob 92 368 mpupsr4 mpu privilege select register region 4 oa ob 93 372 mpupsr5 mpu privilege select register region 5 oa ob 94 376 mpupsr6 mpu privilege select register region 6 oa ob 95 380 mpupsr7 mpu privilege select register region 7 oa ob 96 384 mpucra mpu cacheable register a oa ob 97 388 mpucrb mpu cacheable register b oa ob 98 392 mpubra mpu bufferable register a oa ob 99 396 mpubrb mpu bufferable register b oa ob 100 400 mpuapra mpu access permission register a oa ob 101 404 mpuaprb mpu access permission register b oa ob 102 408 mpucr mpu control register oa ob 103 412 ss_status secure state status register oa ob 104 416 ss_adrf secure state address flash register oa ob 105 420 ss_adrr secure state address ram register oa ob 106 424 ss_adr0 secure state address 0 register oa ob 107 428 ss_adr1 secure state address 1 register oa ob 108 432 ss_sp_sys secure state stac k pointer system register oa ob 109 436 ss_sp_app secure state stack pointer application register oa ob 110 440 ss_rar secure state return address register oa ob 111 444 ss_rsr secure state return status register oa ob 112-191 448-764 reserved reserved for future use - - 192-255 768-1020 impl implementation defined - - table 2-7. system registers (continued) reg # address name function compliance
18 32000d?04/2011 avr32 should be written to zero, making acba word aligned. failing to do so may result in erroneous behaviour. cpucr - cpu control register register controlling the configurat ion and behaviour of the cpu. th e behaviour of this register is implementation defined. an example of a typi cal control bit in the cpucr is an enable bit for branch prediction. ecr - exception cause register this register identifies the cause of the most recently executed exception. this information may be used to handle exceptions more efficiently in certain opera ting systems. the register is updated with a value equal to the evba offset of the exception, shifted 2 bit positions to the right. only the 9 lowest bits of the evba offset are considered. as an example, an itlb miss jumps to evba+0x50. the ecr will then be load ed with 0x50>>2 == 0x14. the ecr register is not loaded when an scall , breakpoint or ocd stop cpu exception is taken. note that for inter- rupts, the offset is given by the autovector provided by the interrupt controller. the resulting ecr value may therefore overlap with an ecr val ue used by a regular exception. this can be avoided by choosing the autovector offsets so that no such overlaps occur. rsr_sup, rsr_int0, rsr_int1, rsr_int2, rsr_int3 , rsr_ex, rsr_nmi - return status registers if a request for a mode change, for instance an in terrupt request, is accepted when executing in a context c , the status register values in context c are automatically stored in the return sta- tus register (rsr) associated with the interrupt context i . when the execution in the interrupt state i is finished and the rets / rete instruction is encountered, the rsr associated with i is cop- ied to sr, and the execution continues in the original context c . rsr_dbg - return status register for debug mode when debug mode is entered, the status register contents of the original mode is automatically saved in this register. when the debug routine is finished, the retd instruction copies the con- tents of rsr_dbg into sr. rar_sup, rar_int0, rar_int1, rar_in t2, rar_int3, rar_ex, rar _nmi - return address registers if a request for a mode change, for instance an in terrupt request, is accepted when executing in a context c , the re-entry address of context c is automatically stored in the return address reg- ister (rar) associated with the interrupt context i . when the execution in the interrupt state i is finished and the rets / rete instruction is encountered, a change-of-flow to the address in the rar associated with i , and the execution continues in the original context c . the calculation of the re-entry addresses is described in section 8. ?event processing? on page 63 . rar_dbg - return address register for debug mode when debug mode is entered, the program counter contents of the original mode is automati- cally saved in this register. when the debug routine is finished, the retd instruction copies the contents of rar_dbg into pc. jecr - java exception cause register this register contains information needed for java traps, see avr32 java technical reference manual for details. josp - java operand stack pointer this register holds the java operand stack pointer. the register is initialized to 0 at reset.
19 32000d?04/2011 avr32 java_lvx - java local variable registers the java extension module uses these registers to store local variables temporary. jtba - java trap base address this register contains the base address to the program code for the trapped java instructions. jbcr - java write barri er control register this register is used by the garbage collector in the java virtual machine. config0 / 1 - configuration register 0 / 1 used to describe the processor, its configuration and capabilities. the contents and functionality of these registers is described in detail in section 2.11.1 ?configuration registers? on page 21 . count - cycle counter register the count register increments once every cloc k cycle, regardless of pipeline stalls and flushes. the count register can both be read and written. the count register can be used together with the compare register to create a timer with interrupt functionality. the count register is written to zero upon reset and compare match. revision 3 of the avr32 architecture allows some implementations to disable this automatic clearing of count upon compare match, usually by programming a bit in cpucr. refer to the technical reference manual for the device for details. incrementation of the co unt register can not be disabled. the count register will increment even though a compare interrupt is pending. compare - cycle counter compare register the compare register holds a value that the count register is compared against. the com- pare register can both be read and written. when the compare and count registers match, a compare interrupt request is generated and count is reset to 0. this interrupt request is routed out to the interrupt controller, which may forward the request back to the processor as a normal interrupt request at a priority level determined by the interrupt controller. writing a value to the compare register clears any pending compare interrupt requests. the compare and exception generation feature is disabled if the compare register contains the value zero. the compare register is written to zero upon reset. tlbehi - mmu tlb entry register high part used to interface the cpu to the tlb. the conten ts and functionality of the register is described in detail in section 5. ?memory management unit? on page 35 . tlbelo - mmu tlb entry register low part used to interface the cpu to the tlb. the conten ts and functionality of the register is described in detail in section 5. ?memory management unit? on page 35 . ptbr - mmu page table base register contains a pointer to the start of the page table. the contents and functionality of the register is described in detail in section 5. ?memory management unit? on page 35 . tlbear - mmu tlb exception address register contains the virtual address that caused the most recent mmu error. the contents and function- ality of the register is described in detail in section 5. ?memory management unit? on page 35 .
20 32000d?04/2011 avr32 mmucr - mmu control register used to control the mmu and the tlb. the contents and functionality of the register is described in detail in section 5. ?memory management unit? on page 35 . tlbarlo / tlbarhi - mmu tlb accessed register low / high contains the accessed bits for the tlb. th e contents and functionality of the register is described in detail in section 5. ?memory management unit? on page 35 . pccnt - performance clock counter clock cycle counter for performance counters. the contents and functionality of the register is described in detail in section 7. ?performance counters? on page 57 . pcnt0 / pcnt1 - performance counter 0 / 1 counts the events specified by the performa nce counter control register. the contents and functionality of the register is described in detail in section 7. ?performance counters? on page 57 . pccr - performance counter control register controls and configures the setup of the performance counters. the contents and functionality of the register is described in detail in section 7. ?performance counters? on page 57 . bear - bus error address register physical address that caused a data bus error. this register is read only. writes are allowed, but are ignored. mpuarn - mpu address register n registers that define the base address and size of the protection regions. refer to section 6. ?memory protection unit? on page 51 for details. mpupsrn - mpu privilege select register n registers that define which privilege register set to use for the different subregions in each pro- tection region. refer to section 6. ?memory protection unit? on page 51 for details. mpucra / mpucrb - mpu cacheable register a / b registers that define if the different protection regions are cacheable. refer to section 6. ?mem- ory protection unit? on page 51 for details. mpubra / mpubrb - mpu bufferable register a / b registers that define if the different protection regions are bufferable. refer to section 6. ?mem- ory protection unit? on page 51 for details. mpuapra / mpuaprb - mpu access permission register a / b registers that define the access permissions for the different protection regions. refer to sec- tion 6. ?memory protection unit? on page 51 for details. mpucr - mpu control register register that control the operation of the mpu. refer to section 6. ?memory protection unit? on page 51 for details.
21 32000d?04/2011 avr32 ss_status - secure state status register register that can be used to pass status or other information from the secure state to the nonse- cure state. refer to section 4. ?secure state? on page 31 for details. ss_adrf, ss_adrr, ss_adr0, ss_adr1 - secure state ad dress registers registers used to partition memories into a secure and a nonsecure section. refer to section 4. ?secure state? on page 31 for details. ss_sp_sys, ss_sp_app - secure stat e sp_sys and sp_app registers read-only registers containing the sp _sys and sp_app values. refer to section 4. ?secure state? on page 31 for details. ss_rar, ss_rsr - secure state return ad dress and return status registers contains the address and status register of the sscall instruction that called secure state. also used when returning to nonsecure state with the retss instruction. refer to section 4. ?secure state? on page 31 for details. 2.11.1 configuration registers configuration registers are used to inform applications and operating systems about the setup and configuration of the processor on which it is running, see figure 2-8 on page 21 . the avr32 implements the following read-only configuration registers. figure 2-8. configuration registers table 2-8 on page 21 shows the config0 fields. table 2-8. config0 fields name bit description processor id 31:24 specifies the type of processor. this allows the application to distinguish between different processor implementations. reserved 23:20 reserved for future use. processor revision 19:16 specifies the revision of the processor implementation. processor id at 0 9 24 31 config0 76 processor revision ar mmut 23 16 15 13 12 10 s immu sz iset 26 31 config1 ilsz 25 20 19 15 16 12 dmmu sz iass 13 dset dlsz 10 9 6 5 dass 3 p o f 5 0 j 4 2 32 d r 1 - 19 20
22 32000d?04/2011 avr32 at 1 5 : 1 3 architecture type value semantic 0 avr32a 1 avr32b other reserved ar 12:10 architecture revision. specifie s which revision of the avr32 architecture the processor implements. value semantic 0 revision 0 1 revision 1 2 revision 2 3 revision 3 other reserved mmut 9:7 mmu type value semantic 0 none, using direct mapping and no segmentation 1 itlb and dtlb 2 shared tlb 3 memory protection unit other reserved f6 floating-point unit implemented value semantic 0 no fpu implemented 1 fpu implemented j5 java extension implemented value semantic 0 no java extension implemented 1 java extension implemented p4 performance counters implemented value semantic 0 no performance counters implemented 1 performance counters implemented o3 on-chip debug implemented value semantic 0 no ocd implemented 1 ocd implemented table 2-8. config0 fields (continued) name bit description
23 32000d?04/2011 avr32 table 2-9 on page 23 shows the config1 fields. s2 simd instructions implemented value semantic 0 no simd instructions 1 simd instructions implemented d1 dsp instructions implemented value semantic 0 no dsp instructions 1 dsp instructions implemented r0 memory read-modify-write instructions implemented value semantic 0 no rmw instructions 1 rmw instructions implemented table 2-9. config1 fields name bit description immu sz 31:26 the number of entries in the immu equals (immu sz) + 1. not used in single-mmu or mpu systems. dmmu sz 25:20 specifies the number of entries in the dmmu or in the shared mmu in single-mmu systems. the number of entries in the dmmu or shared mmu equals (dmmu sz + 1). in systems with mpu, dmmu sz equals the number of mpuar entries. table 2-8. config0 fields (continued) name bit description
24 32000d?04/2011 avr32 iset 19:16 number of sets in icache value semantic 01 12 24 38 416 532 664 7128 8256 9512 10 1024 11 2048 12 4096 13 8192 14 16384 15 32768 ilsz 15:13 line size in icache value semantic 0 no icache present 14 bytes 28 bytes 316 bytes 432 bytes 564 bytes 6 128 bytes 7 256 bytes table 2-9. config1 fields (continued) name bit description
25 32000d?04/2011 avr32 iass 12:10 associativity of icache value semantic 0 direct mapped 12-way 24-way 38-way 416-way 532-way 664-way 7 128-way dset 9:6 number of sets in dcache value semantic 01 12 24 38 416 532 664 7128 8256 9512 10 1024 11 2048 12 4096 13 8192 14 16384 15 32768 table 2-9. config1 fields (continued) name bit description
26 32000d?04/2011 avr32 2.12 recommended call convention the compiler vendor is free to define a call convention, but seen from a hardware point of view, there are some recommendations on how the call convention should be defined. register r12 is intended as return value register in connection with function calls. some instruc- tions will use this register implic itly. for instance , the conditional ret instruction will move its argument into r12. dlsz 5:3 line size in dcache value semantic 0 no dcache present 14 bytes 28 bytes 316 bytes 432 bytes 564 bytes 6 128 bytes 7 256 bytes dass 2:0 associativity of dcache value semantic 0 direct mapped 12-way 24-way 38-way 416-way 532-way 664-way 7 128-way table 2-9. config1 fields (continued) name bit description
27 32000d?04/2011 avr32 3. java extension module the avr32 architecture can optionally support execution of java bytecodes by including a java extension module (jem). this support is included with minimal hardware overhead. comparing java bytecode instructions with nativ e avr32 instructions, we see that a large part of the instructions overlap as illustrated in figure 3-1 on page 27 . the idea is thus to reuse the hardware resources by adding a separate java instruction decoder and control module that exe- cutes in java state. the processor keeps track of its execution state through the status register and changes execution mode seamlessly. in a larger runtime system, an operating system keeps track of and dispatches different pro- cesses. a java program will typically be o ne, or several, of these processes. the java state is not to be confused with the security modes ?system? and ?application?, as the jem can execute in both modes. when the processor switches instruction decoder and enters java state, it does not affect the security leve l set by the system. a java program could also be executed from the different interrupt levels without interfering with the mode settings of the pro- cessor, although it is not recommended that interrupt routines are written in java due to latency. the java binary instructions are called bytecodes. these bytecodes are one or more bytes long. a bytecode consists of an opcode and optional arguments. the bytecodes include some instruc- tions with a high semantic content. in order to reduce the hardware overhead, these instructions are trapped and executed as small risc programs. these programs are stored in the program memory and can be changed by the programmer (part of the java vm implementation). this gives full flexibility with regards to future exte nsions of the java instruction set. performance is ensured through an efficient trapping mechanism and ?java tailored? risc instructions. figure 3-1. a large part of the instruction set is shared between the avr risc and the java virtual machine. the java instruction set in cludes instructions with high semantic contents while the avr risc instruction set complements java?s set with tradi- tional hardware near risc instructions 3.1 the avr32 java virtual machine the avr32 java virtual machine consists of tw o parts, the java extension module in hardware and the avr32 specific java virtual machine software, see figure 3-2 on page 28 . together, the two modules comply with the java virtual machine specification. high level instructio ns lo w level instructio ns  ja va additions avr ris c additions ja va avr common
28 32000d?04/2011 avr32 the avr32 java virtual machine software loads and controls the execution of the java classes. the bytecodes are executed in hardware, except for some instructions, for example the instruc- tions that create or manipulate objects. these are trapped and executed in software within the java virtual machine. figure 3-2. overview of the avr32 java virtual machine and the java extension module. the grey area represent the software parts of the virtual machine, while the white box to the right represents the hardware module. figure 3-3 on page 29 shows one example on how a java program is executed. the processor boots in avr32 (risc) state and it executes applications as a normal risc processor. to invoke a java program, the java virtual machine is called like any other application. the java virtual machine will execute an init routine foll owed by a class loader that parses the class and initializes all registers necessary to start executing the java program. the last instruction in the header data class variables attributes methods meta data constant pool garbage collector stack pc, sp local variables const. pool pointer trapped object bytecodes scheduler avr32 java extension module other trapped bytecodes avr32 java virtual machine heap objects method area classes threads frames
29 32000d?04/2011 avr32 class loader is the ?retj? instruction that sets the processor in the java state. this means that the instruction decoder now decodes java opc odes instead of the normal avr32 opcodes. figure 3-3. example of running a java program void ajvm() { init(); classloader(); retj; iconst_1 istore_0 iconst_2 getfield iconst_1 istore_0 iconst_2 return void cleanup() { } ret } java extension module avr32 java virtual machine mfsr r12, jecr cp r12, 0x8 cleanup() application mfsr r12, jecr cp r12, 0x8 retj trap routines void main() { function1 (); application (); ajvm(arguments)
30 32000d?04/2011 avr32 during execution of the java program, the java extension module will encounter some byte- codes that are not supported in hardware. the instruction decoder will automatically recognize these bytecodes and switch the processor back into risc state and at the same time jump to a predefined location where it will ex ecute a software rout ine that performs th e semantic of the trapped bytecode. when finished, the routine ends with a ?r etj? instruction. this instruction will make the avr32 core return to java state and the java program will continue at the correct location. detailed technical information about the java ex tension module is available in a separate java technical reference document.
31 32000d?04/2011 avr32 4. secure state revision 3 of the avr32 architecture introduces a secure execution state. this state is intended to allow execution of a proprietary secret code alongside code of unknown origin and intent on the same processor. for example, a company with a proprietary algorithm can program this algorithm into the secure memory sections of the device, and resell the device with the pro- grammed algorithm to an end cu stomer. the end customer will not be able to read or modify the preprogrammed code in any way. examples of such preprogrammed code can be multimedia codecs, digital signal processing algorithms or telecom software stacks. whereas previous approaches to this problem required the propri etary code and the end user application to exe- cute on separate devices, the secure state allows integration of the two codes on the same device, saving cost and increasing performance since inter-ic communication is no longer required. in order to keep the pr oprietary code secret, this code will execute in a ?secure world?. the end user application will execute in a ?nonsecure world?. code in the nonsecure world can request services from the secure world by executing a special instruction, sscall . this instruction is exe- cuted in the context of an api specified by the provider of the proprietary code. the sscall instruction can be associated with arguments passed in registers or memory, and after execu- tion of the requested algorithm, the secure world returns results to the requesting nonsecure application in regist ers or in memory. hardware is implemented to divide the memory resources into two sections, one secure and one non-secure section. the secure section of the memories can only be accessed (read, written or executed) from code running in the secure world. the nonsecure section of the memories can be read, written or executed from the nonsecure world, and read or written from the secure world. the customer can choose if his application will enable the secure state support or not. an implementation defined mechanism, usually a flash fuse, is used to enable or disable secure state support. if this mechanism is programmed so as to disable the secure state, the system will boot in nonsecure wo rld, and its behavior will be identi cal to previous devices imple- menting older revisions of the avr32 architecture. if the system is set up to enable secure state support, the system will boot in t he secure state. this allows configuration and startup of the secure world application before execution is passed to the nonsecure world. 4.1 mechanisms implementi ng the secure state the following architectural mechanisms are used to implement the secure state: the sscall and retss instructions are used for passing between the secure and nonsecure worlds.  the secure world has a dedicated stack pointer, sp_sec, which is automatically banked into the register file whenever executing in the secure world.  the ss bit is set in the status register whenever the system is in the secure state. only sscall and retss can alter this bit.  interrupts and exceptions have special handler addresses used when receiving interrupts or exceptions in the secure world. this allows executing the interrupt or exception handler in the secure world, or jumping back into the nonsecure world to execute the handler there.  a set of secure system registers are used to configure the secure world behavior, and to aid in communication between the secure and nonsecure worlds. these registers can be written when in the secure world, but only read when in the nonsecure world.
32 32000d?04/2011 avr32  when trying to access secure world memories from the nonsecure world, a bus error exception will be raised, and the access will be aborted. writes to se cure system registers from within the nonsecure world will simply be disregarded without any error indication.  the on-chip debug (ocd) system is modified to prevent any leak of proprietary code or data to the nonsecure world. this prevents hacking through the use of the ocd system. 4.2 secure state programming model the programming model in the secure state is similar to in normal risc state, except that sp_sec has been banked in, and the secure system registers are available in all privileged modes. figure 4-1. register file in avr32a with secure context application bit 0 supervisor bit 31 pc sr int0pc fintpc int1pc smpc r7 r5 r6 r4 r3 r1 r2 r0 bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 int0 sp_app sp_sys r12 r11 r9 r10 r8 exception nmi int1 int2 int3 lr lr bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr secure bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sec lr ss_status ss_adrf ss_adrr ss_adr0 ss_adr1 ss_sp_sys ss_sp_app ss_rar ss_rsr
33 32000d?04/2011 avr32 figure 4-2. register file in avr32b with secure context 4.3 details on secure state implementation refer to the technical reference manual for the cpu core you are using for details on the secure state implementation. application bit 0 supervisor bit 31 pc sr int0pc fintpc int1pc smpc r7 r5 r6 r4 r3 r1 r2 r0 bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 int0 bit 0 bit 31 pc rsr_int0 sr sp_app sp_sys sp_sys r12 r11 r9 r10 r8 banked registers (implementation defined) bit 0 bit 31 pc lr / lr_int2 sp_sys banked registers (implementation defined) rsr_int2 sr bit 0 bit 31 pc rsr_int3 lr / lr_int3 sr sp_sys banked registers (implementation defined) bit 0 bit 31 pc sr sp_sys banked registers (implementation defined) rsr_int1 exception bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr rsr_ex nmi bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sys lr rsr_nmi int1 int2 int3 lr lr rsr_sup lr / lr_int0 lr / lr_int1 rar_int0 rar_int2 rar_int3 rar_int1 rar_ex rar_nmi rar_sup ss_status ss_adrf ss_adrr ss_adr0 ss_adr1 ss_sp_sys ss_sp_app ss_rar ss_rsr secure bit 0 bit 31 pc sr r12 int0pc fintpc int1pc smpc r7 r5 r6 r4 r11 r9 r10 r8 r3 r1 r2 r0 sp_sec lr ss_rar ss_rsr
34 32000d?04/2011 avr32
35 32000d?04/2011 avr32 5. memory management unit the avr32 architecture defines an optional memory management unit (mmu ). this allows effi- cient implementation of virtual memory and large memory spaces. virtual memory simplifies execution of multiple processes and allows allocation of privileges to different sections of the memory space. 5.1 memory map in systems with mmu the avr32 architecture specifies a 32-bit virtual memory space. this virtual space is mapped into a 32-bit physical space by a mmu. it should also be noted that not all implementations will use caches. the cacheability info rmation specified in the figure will therefore not apply for all implementations. refer to the implementation-specific hardware manual for details. the virtual memory map is specified in figure 5-1 . figure 5-1. the avr32 virtual memory space the memory map has six different segments, named p0 through p4, and u0. the p-segments are accessible in the privileged modes, while the u-segment is accessible in the unprivileged mode. both the p1 and p2 segments are default segment translated to the physical address range 0x00000000 to 0x1fffffff. the mapping between virtual addresses and physical addresses is therefore implemented by clearing of msbs in the virtual address. the difference between p1 and p2 is that p1 may be cached, depending on the cache configuration, while p2 is always uncached. because p1 and p2 are segment translated and not page translated, code for initial- ization of mmus and exception vectors are located in these segments. p1, being cacheable, may offer higher performance than p2. 2gb translated space cacheable 512mb system space, non-cacheable 512mb translated space, cacheable 512mb non-translated space, non-cacheable 512mb non-translated space, cacheable unaccessible space access error 2gb translated space cacheable 0x00000000 0x80000000 0xa0000000 0xc0000000 0xe0000000 0xffffffff privileged modes unprivileged mode 0x00000000 0x80000000 0xffffffff p0 p1 p2 p3 p4 u0
36 32000d?04/2011 avr32 the p3 space is also by default segment translated to the physical address range 0x00000000 to 0x1fffffff. by enabling and setting up the mmu, the p3 space becomes page translated. page translation will overri de segment translation. the p4 space is intended for memory mapping special system resources like the memory arrays in caches. this segment is non-cacheable, non-translated. the u0 segment is accessible in the unprivileged user mode. this segment is cacheable and translated, depending upon the configuration of the cache and the memory management unit. if accesses to other memory addresses than the ones within u0 is made in application mode, an access error exception is issued. the virtual address map is summarized in table 5-1 on page 36 . the segment translation can be disabled by clea ring the s bit in the mmucr. this will place all the virtual memory space into a single 4 gb m apped memory space. doing this will give all access permission control to the ap bits in the tlb entry matching the virtual address, and allow all virtual addresses to be translated. se gment translation is enabled by default. the avr32 architecture has two translations of addresses. 1. segment translation (enabled by the mmucr[s] bit) 2. page translation (enabled by the mmucr[e] bit) both these translations are performed by the mmu and they can be applied independent of each other. this means that you can enable: 1. no translation. virtual and physical addresses are the same. 2. segment translation only. the virtual and physical addresses are the same for addresses residing in the p0, p4 and u0 segments. p1, p2 and p3 are mapped to the physical address range 0x00000000 to 0x1fffffff. 3. page translation only. all addresses are mapped as described by the tlb entries. 4. both segment and page translations. p1 and p2 are mapped to the physical address range 0x00000000 to 0x1fffffff. u0, p0 and p3 are mapped as described by the tlb entries. the virtual and physical addresses are the same for addresses residing in the p4 segment. the segment translation is by default turned on and the page translation is by default turned off after reset. the segment translation is summarized in figure 5-2 on page 37 . table 5-1. the virtual address map virtual address [31:29] segment name virtual address range segment size accessible from default segment translated characteristics 111 p4 0xffff_ffff to 0xe000_0000 512 mb privileged no system space unmapped, uncacheable 110 p3 0xdfff_ffff to 0xc000_0000 512 mb privileged yes mapped, cacheable 101 p2 0xbfff_ffff to 0xa000_0000 512 mb privileged yes unmapped, uncacheable 100 p1 0x9fff_ffff to 0x8000_0000 512 mb privileged yes unmapped, cacheable 0xx p0 / u0 0x7fff_ffff to 0x0000_0000 2 gb unprivileged privileged no mapped, cacheable
37 32000d?04/2011 avr32 figure 5-2. the avr32 segment translation map 5.2 understanding the mmu the avr32 memory management unit (mmu) is responsible for mapping virtual to physical addresses. when a memory access is performed, the mmu translates the virtual address speci- fied into a physical address, while checking t he access permissions. if an error occurs in the translation process, or operat ing system intervention is ne eded for some reason, the mmu will issue an exception, allowing the problem to be resolved by software. the mmu architecture uses paging to map memo ry pages from the 32-bit virtual address space to a 32-bit physical address space. page sizes of 1, 4, 64 kilobytes and 1 megabyte are sup- ported. each page has individual access rights, providing fine protection granularity. the information needed in order to perform the virtual-to-physical mapping resides in a page table. each page has its own entry in the page table. the page table also contains protection information and other data needed in the translation process. conceptually, the page table is accessed for every memory access, in order to read the mapping information for each page. in order to speed up the translation process, a special page table cache is used. this cache is called a translation lookaside buff er (tlb). the tlb contains the n most recently used page table entries. the number n of entries in the tlb is implementation defined. it is also implementation defined whether a single unified tlb should be used for both instruction and memory accesses, or if two separate tlbs are implemented. the architecture supports one or two tlbs with up to 64 entries in each. tlb entries can also be locked in the tlb, guarantee- ing high-speed memory accesses. 2gb translated space cacheable 512mb system space, non-cacheable 512mb translated space, cacheable 512mb non-translated space, non-cacheable 512mb non-translated space, cacheable 0x00000000 0x80000000 0xa0000000 0xc0000000 0xe0000000 0xffffffff p0 / u0 p1 p2 p3 p4 2gb physical address space virtual address space 512mb physical address space 0x00000000 0x80000000 0xe0000000 0xffffffff 0x20000000 physical address space segment translation
38 32000d?04/2011 avr32 5.2.1 virtual memory models the mmu provides two different virtual memory models, selected by the mode (m) bit in the mmu control register:  shared virtual memory, where the same virtual address space is shared between all processes  private virtual memory, where each pr ocess has its own virtual address space in shared virtual memory, the virtual address uniquely identifies which physical address it should be mapped to. two different pr ocesses addressing the same vi rtual address will always access the same physical address. in other words, the virtual page number (vpn) section of the virtual address uniquely specifies the physical frame number (pfn) section in the physical address. in private virtual memory, each process has its own virtual memory space. this is implemented by using both the vpn and the a pplication space identifier (asi d) of the current process when searching the tlb for a match. each process has a unique asid. therefore, two different pro- cesses accessing the same vpn wo n?t hit the same tlb entry, since their asid is different. pages can be shared between processes in private virtual mode by setting the global (g) bit in the page table entry. this will disable the asid check in the tlb search , causing the vpn sec- tion uniquely to identify the pfn for the particular page. 5.2.2 mmu interface registers the following registers are used to control the mmu, and provide the interface between the mmu and the operating system. most registers can be altered both by the application software (by writing to them) and by hardware when an ex ception occurs. all the registers are mapped into the system register space, their addresses are presented in section 2.11 ?system regis- ters? on page 14 . the mmu interface registers are shown in figure 5-3 . figure 5-3. the mmu interface registers vpn asid g d 0 7 10 31 tlbehi pfn c b 0 9 10 31 tlbelo v sz ap w i 876 4321 ptbr 0 31 ptbr tlbear 0 31 tlbear dla e m 0 7 8 31 mmucr ila drp ir p 1 - 2 13 14 20 26 19 25 i 3 98 n 4 5 s tlbarlo / tlbarhi 0 31 tlbarlo / tlbarhi
39 32000d?04/2011 avr32 5.2.2.1 tlb entry register high part - tlbehi the contents of the tlbehi and tlbelo registers is loaded into the tlb when the tlbw instruc- tion is executed. the tlbehi register consists of the following fields:  vpn - virtual page number in the tlb entry. this field contains 22 bits, but the number of bits used depends on the page size. a page size of 1 kb requires 22 bits, while larger page sizes require fewer bits. when preparing to write an entry into the tlb, the virtual page number of the entry to write should be written into vpn. when an mmu-related exception has occurred, the virtual page number of the failing address is written to vpn by hardware.  v - valid. set if the tlb entry is valid, cleared otherwise. this bit is written to 0 by a reset. if an access to a page which is marked as invalid is attempted, an tlb miss exception is raised. valid is set automatically by hardware whenever an mmu exception occurs.  i - instruction tlb. if set, the current tlbehi and tlbelo entries should be written into the instruction tlb. if cleared, the data or unified tlb should be addressed. the i bit is set by hardware when an mmu-related exception occurs, indicating whether the error occurred in the itlb or the utlb/dtlb.  asid - application space identifier. the operating system allocates a unique asid to each process. this asid is written into tlbehi by the os, and used in the tlb address match if the mmu is running in private virtual memory mode and the g bit of the tlb entry is cleared. asid is never changed by hardware. 5.2.2.2 tlb entry register low part - tlbelo the contents of the tlbehi and tlbelo registers is loaded into the tlb when the tlbw instruc- tion is executed. none of the fields in tlbelo are altered by hardware. the tlbelo register consists of the following fields:  pfn - physical frame number to which the vpn is mapped. this field contains 22 bits, but the number of bits used depends on the page size. a page size of 1 kb requires 22 bits, while larger page sizes require fewer bits. when preparing to write an entry into the tlb, the physical frame number of the entry to write should be written into pfn.  c - cacheable. set if the page is cacheable, cleared otherwise.  g - global bit used in the address comparison in the tlb lookup. if the mmu is operating in the private virtual memory mode and the g bit is set, the asid won?t be used in the tlb lookup.  b - bufferable. set if the page is bufferable, cleared otherwise.  ap - access permissions specifying the privilege requirements to access the page. the following permissions can be set, see table 5-2 on page 40 .
40 32000d?04/2011 avr32  sz - size of the page. the following page sizes are provided, see table 5-3 :  d - dirty bit. set if the page has been written to, cleared otherwise. if the memory access is a store and the d bit is cleared, an init ial page write exception is raised.  w - write through. if set, a write-through cache update policy should be used. write-back should be used otherwise. the bit is ignored if the cache only supports write-through or write- back. 5.2.2.3 page table base register - ptbr this register points to the start of the page table structure. the register is not used by hardware, and can only be modified by software. the register is meant to be used by the mmu-related exception routines. 5.2.2.4 tlb exception ad dress register - tlbear this register contains the virtual address that caused the most recent mmu-related exception. the register is updated by hardware when such an exception occurs. 5.2.2.5 mmu control register - mmucr the mmucr controls the operation of the mmu. the mmucr has the following fields:  irp - instruction tlb replacement pointer. poin ts to the itlb entry to overwrite when a new entry is loaded by the tlbw instruction. the irp field may be updated automatically in an implementation defined manner in order to optimize the replacement algorithm. the irp field can also be written by software, allowing the exception routine to implement a replacement algorithm in software. the irp field is 6 bits wide, allowing a maximum of 64 table 5-2. access permissions implied by the ap bits ap privileged mode unprivileged mode 000 read none 001 read / execute none 010 read / write none 011 read / write / execute none 100 read read 101 read / execute read / execute 110 read / write read / write 111 read / write / execute read / write / execute table 5-3. page sizes implied by the sz bits sz page size bits used in vpn bits used in pfn 00 1 kb tlbehi[31:10] tlbelo[31:10] 01 4 kb tlbehi[31:12] tlbelo[31:12] 10 64 kb tlbehi[31:16] tlbelo[31:16] 11 1 mb tlbehi[31:20] tlbelo[31:20]
41 32000d?04/2011 avr32 entries in the itlb. it is implementation defined whether to use fewer entries. impementations with a single unified tlb does not use the irp field.  ila - instruction tlb lockdown amount. specified the number of locked down itlb entries. all itlb entries from entry 0 to entry (ila-1) are locked down. if ila equals zero, no entries are locked down. implementations with a single unified tlb does not use the ila field.  drp - data tlb replacement pointer. points to the dtlb entry to overwrite when a new entry is loaded by the tlbw instruction. the drp field may be updated automatically in an implementation defined manner in order to optimize the replacement algorithm. the drp field can also be written by software, allowing the exception routine to implement a replacement algorithm in software. the drp field is 6 bits wide, allowing a maximum of 64 entries in the dtlb. it is implementation defined whether to use fewer entries. implementations with a single unified tlb use the drp field to point into the unified tlb.  dla - data tlb lockdown amount. specified the number of locked down dtlb or utlb entries. all dtlb entries from entry 0 to entry (dla-1) are locked down. if dla equals zero, no entries are locked down.  s - segmentation enable. if set, the segmented memory model is used in the translation process. if cleared, the memory is regarded as unsegmented. the s bit is set after reset.  n - not found. set if the entry searched for by the tlb search instruction ( tlbs ) was not found in the tlb.  i - invalidate. writing this bit to one invalidates all tlb entries. the bit is automatically cleared by the mmu when the invalidate operation is finished.  m - mode. selects whether the shared virtual memory mode or the private virtual memory mode should be used. the m bit determines how the tlb address comparison should be performed, see table 5-4 on page 41 .  e - enable. if set, the mmu translation is enabled. if cleared, the mmu translation is disabled and the physical address is identical to the virtual address. access permissions are not checked and no mmu-related exceptions are is sued if the mmu is disabled. if the mmu is disabled, the segmented memory model is used. 5.2.2.6 tlb accessed register hi / lo - tlbarhi / tlbarlo the tlbarhi and tlbarlo register form one 64-bit register with 64 1-bit fields. each of these fields contain the accessed bit for the correspo nding tlb entry. the i bit in tlbehi determines whether the itlb or dtlb accessed bits are re ad. the accessed bit is 0 if the page has been accessed, and 1 if it has not been accessed. bit 31-0 in tlbarlo correspond to tlb entry 0- 31, bit 31-0 in tlbarhi correspond to tlb entry 32-63. if the tlb implementation contains less than 64 entries then nonimplemented entries are read as 0. note: the contents of tlbarhi/tlbarlo are reversed to let the count leading zero (clz) instruction be used directly on the contents of the registers. e.g. if clz returns the value four on the contents of tlbarlo, then item four is the first unused item in the tlb. table 5-4. mmu mode implied by the m bit mmode 0 private virtual memory 1 shared virtual memory
42 32000d?04/2011 avr32 5.2.3 page table organization the mmu leaves the page table organization up to the os software. since the page table han- dling and tlb handling is done in software, the os is free to implement different page table organizations. it is recommended, however, that the page table entries (ptes) are of the format shown in figure 5-4. this allows the loaded pte to be written directly into tlbelo, without the need for reformatting. how the ptes are indexed and organized in memory is left to the os. figure 5-4. recommended page table entry format 5.2.4 tlb organization the tlb is used as a cache for the page table, in order to speed up the virtual memory transla- tion process. up to two tlbs can be implemented, each with up to 64 entries. each tlb is configured as shown in figure 5-5 on page 42 . figure 5-5. tlb organization the d, w and ap[1] bits are not implemented in itlbs, since they have no meaning there. the ap[0] bits are not implemented in dtlbs, since they have no meaning there. the a bit is the accessed bit. this bit is set when the tlb entry is loaded with a new value using the tlbw instruction. it is cleared whenever the tlb matching process finds a match in the spe- cific tlb entry. the a bit is used to implement pseudo-lru replacement algorithms. when an address look-up is performed by the tlb, the address section is searched for an entry matching the virtual address to be accessed. the matching process is described in chapter 5.2.5. g d pfn c b 0 9 10 31 sz ap w 876 4321 vpn[21:0] asid[7:0] g d pfn[21:0] c b v ap[2:0] w entry 0 vpn[21:0] asid[7:0] g d pfn[21:0] c b v ap[2:0] w entry 1 vpn[21:0] asid[7:0] g w pfn[21:0] c b v ap[2:0] d entry 2 vpn[21:0] asid[7:0] g w pfn[21:0] c b v ap[2:0] d entry 3 vpn[21:0] asid[7:0] g w pfn[21:0] c b v ap[2:0] d entry 63 address section data section sz[1:0] sz[1:0] sz[1:0] sz[1:0] sz[1:0] a a a a a
43 32000d?04/2011 avr32 5.2.5 translation process the translation process maps addresses from the virtual address space to the physical address space. the addresses are generated as shown in table 5-5 , depending on the page size chosen: a data memory access can be described as shown in table 5-6 . table 5-5. physical address generation page size physical address 1 kb pfn[31:10], va[9:0] 4 kb pfn[31:12], va[11:0] 64 kb pfn[31:16], va[15:0] 1 mb pfn[31:20], va[19:0] table 5-6. data memory access pseudo-code example if (segmentation disabled) if (! pagingenabled) performaccess(cached, write-back); else performpagedaccess(va); else if (va in privileged space) if (inapplicationmode) signalexception(dtlb protection, accesstype); endif; if (va in p4 space) performaccess(non-cached); else if (va in p2 space) performaccess(non-cached); else if (va in p1 space) performaccess(cached, writeback); else // va in p0, u0 or p3 space if ( ! pagingenabled) performaccess(cached, writeback); else performpagedaccess(va); endif; endif; endif;
44 32000d?04/2011 avr32 the translation process performed by performtranslatedaccess( ) can be described as shown in table 5-7 . table 5-7. performtranslatedaccess( ) pseudo-code example match 0; for (i=0; i 45 32000d?04/2011 avr32 an instruction memory access can be described as shown in table 5-8 . table 5-8. instruction memory access pseudo-code example if (segmentation disabled) if (! pagingenabled) performaccess(cached, write-back); else performpagedaccess(va); else if (va in privileged space) if (inapplicationmode) signalexception(itlb protection, accesstype); endif; if (va in p4 space) performaccess(non-cached); else if (va in p2 space) performaccess(non-cached); else if (va in p1 space) performaccess(cached, writeback); else // va in p0, u0 or p3 space if ( ! pagingenabled) performaccess(cached, writeback); else performpagedaccess(va); endif; endif; endif;
46 32000d?04/2011 avr32 the translation process performed by performtranslatedaccess( ) can be described as as shown in table 5-9 . table 5-9. performtranslatedaccess( ) pseudo-code example match 0; for (i=0; i 47 32000d?04/2011 avr32 5.3 operation of the mm u and mmu exceptions the mmu uses both hardware and software mechanisms in order to perform its memory remap- ping operations. the following tasks are performed by hardware: 1. the mmu decodes the virtual address and tries to find a matching entry in the tlb. this entry is used to generate a physical address. if no matching entry is found, a tlb miss exception is issued. 2. the matching entry is used to determine whether the access has the appropriate access rights, cacheability, bufferability and so on. if the access is not permitted, a tlb protection violation exception is issued. 3. if any other event arises that requires software intervention, an appropriate exception is issued. 4. if the correct entry was found in the tlb, and the access permissions were not violated, the memory access is performed without any further software intervention. the following tasks must be performed by software: 1. setup of the mmu hardware by initializing the mmu-relate d registers and data struc- tures if needed. 2. maintenance of the tlb structure. tlb entries are written, invalidated and replaced by means of software. a tlbw instruction is included in the instruction set to support this. 3. the mmu may generate several exceptions. software exception handlers must be writ- ten in order to service these exceptions. 5.3.1 the tlbw instruction the tlbw instruction is implemented in order to aid in performing tlb maintenance. the instruc- tion copies the contents of tlbehi and tlbelo into the tlb entry pointed to by the itlb or dtlb replacement pointers (irp/drp) in the mmu control register. the tlbehi[i] bit decides if the itlb or the dtlb should be addressed. irp and drp may in some implementations be automatically updated by hardware in order to implement a tlb replacement algorithm in hard- ware. software may update them before executing tlbw in order to implement a software replacement algorithm. in some implementations, the tlb data structures may be mapped into the p4 space. in such implementations, the tlb data structures may be updated with regular memory access instructions. 5.3.2 tlb synonyms implementations using virtually indexed caches may be subject to cache inconsistencies, depending on the page size used and number of lines in the cache. these inconsistencies may occur when multiple virtual addresses are mapped to the same physical address, since a trans- lated part of vpn may be used to index the cache. this implies that the same physical address may be mapped to different cache lines, causing cache inconsistency. synonym problems can only appear when addressing data residing in a virtually indexed cache. addressing uncached memory or accessing untranslated memory will never cause synonym problems. it is the responsability of the os to def ine a policy ensu ring that no synony m problems may arise. no hardware support is provided to avoid tlb synonyms.
48 32000d?04/2011 avr32 5.3.3 mmu exception handling this chapter describes the software actions that must be performed for mmu-related excep- tions. the hardware actions performed by the exceptions are described in detail in section 8.3.1 ?description of events in avr32a? on page 68 . 5.3.3.1 itlb / dtlb multiple hit if multiple matching entries are found when searching the itlb or dtlb, this exception is issued. this situation is a crit ical error, since memory consistency can no longer be guaranteed. the exception hardware therefore jumps to the reset vector, where software should execute the required reset code. this exception is a sign of erroneous code and is not normally generated. the software handler should perform a normal system restart. however, debugging code may be inserted in the handler. 5.3.3.2 itlb / dtlb miss this exception is issued if no matching entries are found in the tlbs, or when a matching entry is found with the valid bit cleared. the same actions must be performed for both exceptions, but dtlb entries contains more control bits than the itlb entries. 1. examine the tlbear and tlbehi registers in order to iden tify the page that caused the fault. use this to index the page table pointed to by ptbr and fetch the desired page table entry. 2. use the fetched page table entry to update the necessary bits in ptehi and ptelo. the following bits must be updated, not all bits apply to itlb entries: v, pfn, c, g, b, ap[2:0], sz[1:0], w, d. 3. the tlbehi[i] register is updated by hardware to indicate if it was a itlb or a dtlb miss. the mmucr[irp] and mmucr[drp] po inters may be updated in an imple- mentation defined way in order to select which tlb entry to replace. the software may override this value by writing a valu e directly to mmucr[irp] or mmucr[drp], depending on which tlb to update. 4. execute the tlbw instruction in order to update the tlb entry. 5. finish the exception handling and return to the application by executing the rete instruction. 5.3.3.3 itlb / dtlb protection violation this exception is issued if the access permision bits in the matching tlb entry does not match the privilege level the cpu is currently executi ng in. the exception is also issued if the mmu is disabled or absent and non-translated areas are a ccessed with illegal access rights. the same actions must be performed for both exceptions, but dtlb entries contains more control bits than the itlb entries. software must examine the tlbear and tlbehi registers in order to identify the instruction and process that caused the error. corrective measures like terminating the process must then be performed before returning to normal execution with rete .
49 32000d?04/2011 avr32 5.3.3.4 dtlb modified this exception is issued if a va lid memory write operation is performed to a page that has never been written before. this is detected by the dirty-bit in the matching tlb entry reading zero. 1. examine the tlbear and tlbehi registers in order to iden tify the page that caused the fault. use this to index the page table pointed to by ptbr and fetch the desired page table entry. 2. set the dirty bit in the read page table entry and write this entry back to the page table 3. use the fetched page table entry to update the necessary bits in ptehi and ptelo. the following bits must be updated: v, pfn, c, g, b, ap[2:0], sz[1:0], w, d. 4. the tlbehi[i] register is updated by hardware to indicate that it was a dtlb miss. ensure that mmucr[drp] points to the tlb entry to replace. an entry for the faulting page must already exist in the dtlb, and mmucr[drp] must point to this entry, other- wise multiple dtlb hits may occur. 5. execute the tlbw instruction in order to update the tlb entry. 6. finish the exception handling and return to the application by executing the rete instruction.
50 32000d?04/2011 avr32
51 32000d?04/2011 avr32 6. memory protection unit the avr32 architecture defines an optional memory protection unit (mpu). this is a simpler alternative to a full mmu, while at the same time allowing memory protection. the mpu allows the user to divide the memory space into different protection regions. these protection regions have a user-defined size, and starts at a user-defined address. the different regions can have different cacheability attributes an d bufferability attribut es. each region is di vided into 16 subre- gions, each of these subregions can have on e of two possible sets of access permissions. the mpu does not perform any address translation. 6.1 memory map in systems with mpu an avr32 implemetation with a mpu has a fl at, unsegmented memory space. access permis- sions are given only by the different protection regions. 6.2 understanding the mpu the avr32 memory protection unit (mpu) is responsible for checking that memory transfers have the correct permissions to complete. if a memory access with unsati sfactory privileges is attempted, an exception is generated and the access is aborted. if an access to a memory address that does not reside in any protection region is attempted, an exception is generated and the access is aborted. the user is able to allow different privilege levels to different blocks of memory by configuring a set of registers. each such block is called a protection region. each region has a user-program- mable start address and size. the mpu allows the user to program 8 different protection regions. each of these regions have 16 sub-r egions, which can have different access permis- sions, cacheabilit y and bufferability. the ?dmmu sz? fields in the config1 system register identifies the number of implemented protection regions, and therefore also the number of mpu registers. a system with caches also have mpu cacheability and bufferability registers. a protection region can be from 4 kb to 4 gb in size, and the size must be a power of two. all regions must have a start address that is aligned to an address corresponding to the size of the region. if the region has a size of 8 kb, the 13 lowe st bits in the start address must be 0. failing to do so will result in undefined behaviour. sinc e each region is divi ded into 16 sub-regions, each sub-region is 256 b to 256 mb in size. when an access hits into a memory region set up by the mpu, hardware proceeds to determine which subregion the access hits into. this info rmation is used to determine whether the access permissions for the subregi on are given in mpuapra/mpubra/mpucra or in mpuaprb/mpubrb/mpucrb. if an access does not hit in any region, the tr ansfer is aborted and an exception is generated. the mpu is enabled by writing setting the e bit in the mpucr register. the e bit is cleared after reset. if the mpu is disabled, all accesses ar e treated as uncacheable, unbufferable and will not generate any access violations. before setting the e bit, at least one valid protection region must be defined. 6.2.1 mpu interface registers the following registers are used to control the mpu, and provide the interface between the mpu and the operating system, see figure 6-1 on page 52 . all the registers are mapped into the sys-
52 32000d?04/2011 avr32 tem register space, their addresses are presented in ?system registers? on page 14 . they are accessed with the mtsr and mfsr instructions. the mpu interface registers are shown below. th e suffix n can have the range 0-7, indicating which region the register is associated with. figure 6-1. the mpu interface registers 6.2.1.1 mpu address register - mpuarn a mpu address register is implemented for each of the 8 protection regions. the mpuar regis- ters specify the start address and size of the regions. the start address must be aligned so that its alignment corresponds to the size of the regi on. the minimum allowable size of a region is 4 kb, so only bits 31:12 in the base address needs to be specified. the other bits are always 0. each mpuar also has a valid bit t hat specifies if the protection re gion is valid. only valid regions are considered in the protection testing. the mpuar register consists of the following fields:  base address - the start address of the region. the minimum size of a region is 4kb, so only the 20 most significant bits in the base address needs to be specified. the 12 lowermost base address bits are implicitly set to 0. if protection regions larger than 4 kb is used, the user must write the appropriate bits in base address to 0, so that the base address is aligned to the size of the region. otherwise, the result is undefined. base address size 0 5 12 31 mpuarn - 0 31 - 876 4321 0 31 0 31 e 0 31 mpucr - 1 11 6 v 1 mpucra / mpucrb 5 mpubra / mpubrb - 876 4321 5 mpuapra / mpuaprb ap0 ap1 ap2 ap3 ap4 ap5 ap6 ap7 3 4 7 8 11 12 15 16 19 20 23 24 27 28 - 31 mpupsrn p10 p11 p12 p13 p14 p15 p4 p5 p6 p7 p8 p9 p0 p1 p2 p3 0 876 4321 5 9 16 15 13 12 11 10 14 c4 c5 c6 c7 c0 c1 c2 c3 b4 b5 b6 b7 b0 b1 b2 b3
53 32000d?04/2011 avr32  size - size of the protection region. the possible sizes are shown in table 6-1 on page 53 .  v - valid. set if the protection region is valid, cleared otherwise. this bit is written to 0 by a reset. the region is not considered in the protection testing if the v bit is cleared. 6.2.1.2 mpu permission select register - mpupsrn a mpu permission select register is implemented for each of the 8 protection regions. each mpupsr register divides the protection regi on into 16 subregions. the bitfields in mpupsr specifies whether each subregion has access permissions as specified by the region entry in either mpuapra or mpuaprb. table 6-1. protection region sizes implied by the size field size region size constr aints on base address b?00000 to b?01010 undefined - b?01011 4 kb none b?01100 8 kb bit [12] in size must be 0 b?01101 16 kb bit [13:12] in size must be 0 b?01110 32 kb bit [14:12] in size must be 0 b?01111 64 kb bit [15:12] in size must be 0 b?10000 128 kb bit [16:12] in size must be 0 b?10001 256 kb bit [17:12] in size must be 0 b?10010 512 kb bit [18:12] in size must be 0 b?10011 1 mb bit [19:12] in size must be 0 b?10100 2 mb bit [20:12] in size must be 0 b?10101 4 mb bit [21:12] in size must be 0 b?10110 8 mb bit [22:12] in size must be 0 b?10111 16 mb bit [23:12] in size must be 0 b?11000 32 mb bit [24:12] in size must be 0 b?11001 64 mb bit [25:12] in size must be 0 b?11010 128 mb bit [26:12] in size must be 0 b?11011 256 mb bit [27:12] in size must be 0 b?11100 512 mb bit [28:12] in size must be 0 b?11101 1 gb bit [29:12] in size must be 0 b?11110 2 gb bit [30:12] in size must be 0 b?11111 4 gb bit [31:12] in size must be 0 table 6-2. subregion access permission implied by mpupsr bitfields mpupsrn[p] access permission 0 mpuapra[apn] 1 mpuaprb[apn]
54 32000d?04/2011 avr32 6.2.1.3 mpu cacheable regi ster a / b- mpucra / mpucrb the mpucr registers have one bit per region, indicating if the region is cacheable. if the corre- sponding bit is set, the region is cacheable. the register is written to 0 upon reset. avr32uc implementations may optionally choose not to implement the mpucr registers. 6.2.1.4 mpu bufferable register a / b- mpubra / mpubrb the mpubr registers have one bit per region, indicating if the region is bufferable. if the corre- sponding bit is set, the region is bufferable. the register is written to 0 upon reset. avr32uc implementations may optionally choose not to implement the mpubr registers. 6.2.1.5 mpu access permission register a / b - mpuapra / mpuaprb the mpuapr registers indicate the access per missions for each region. the mpuapr is writ- ten to 0 upon reset. the possible access permissions are shown in table 6-3 on page 54 . 6.2.1.6 mpu control register - mpucr the mpucr controls the operation of the mpu. the mpucr has only one field:  e - enable. if set, the mpu address checking is enabled. if cleared, the mpu address checking is disabled and no except ions will be generated by the mpu. 6.2.2 mpu exception handling this chapter describes the exceptions that can be signalled by the mpu. 6.2.2.1 itlb protection violation an itlb protection violation is issued if an instruction fetch violates access permissions. the vio- lating instruction is not executed. the address of the failing instruction is placed on the system stack. table 6-3. access permissions implied by the apn bits ap privileged mode unprivileged mode b?0000 read none b?0001 read / execute none b?0010 read / write none b?0011 read / write / execute none b?0100 read read b?0101 read / execute read / execute b?0110 read / write read / write b?0111 read / write / execute read / write / execute b?1000 read / write read b?1001 read / write read / execute b?1010 none none other undefined undefined
55 32000d?04/2011 avr32 6.2.2.2 dtlb protection violation an dtlb protection violation is issued if a data access violates access permissions. the violat- ing access is not executed. the address of the failing instruction is placed on the system stack. 6.2.2.3 itlb miss violation an itlb miss violation is issued if an instructi on fetch does not hit in any region. the violating instruction is not executed. the address of the failing instruction is placed on the system stack. 6.2.2.4 dtlb miss violation an dtlb miss violation is issued if a data a ccess does not hit in any region. the violating access is not executed. the add ress of the failing instruction is placed on the system stack. 6.2.2.5 tlb multiple hit violation an access hit in multiple protection regions. the address of the failing instruction is placed on the system stack. this is a critical system error that should not occur. 6.3 example of mpu functionality as an example, consider region 0. let region 0 be of size 16 kb, thus each subregion is 1kb. subregion 0 has offset 0-1kb from the base address, subregion 1 has offset 1kb-2kb and so on. mpuapra and mpuaprb each has one field per region. each subregion in region 0 can get its access permissions from either mpuapra[ap0] or mpuaprb[ap0], th is is selected by the sub- region?s bitfield in mpupsr0. let: mpupsr0 = {0b0000_0000_0000_0000, 0b1010_0000_1111_0101} mpuapra = {a, b, c, d, e, f, g, h} mpuaprb = {a, b, c, d, e, f, g, h} where {a-h, a-h} have legal values as defined in table 6-3 . thus for region 0: table 6-4. example of access rights for subregions subregion access permission subregion access permission 0h8h 1h9h 2h10h 3h11h 4h12h 5h13h 6h14h 7h15h
56 32000d?04/2011 avr32
57 32000d?04/2011 avr32 7. performance counters 7.1 overview a set of performance counters let users evaluate the performance of the system. this is useful when scheduling code and performing optimizations. two configurable event counters are pro- vided in addition to a clock cycle counter. these three counters can be used to collect information about for example cache miss rates, branch prediction hit rate and data hazard stall cycles. the three counters are implemented as 32-bit registers accessible through the system register interface. they can be configured to issue an in terrupt request in case of overflow, allowing a software overflow counter to be implemented. a performance counter control register is implemented in addition to the three counter registers. this register controls which events to record in the counter, counter overflow interrupt enable and other configuration data. 7.2 registers 7.2.1 performance clock counter - pccnt this register counts cpu clock cycles. when it reaches 0xffff_ffff, it rolls over. the over- flow flag is set and an exception is generated if configured by pccr. the register can be reset by writing to the c bit in pccr. pccnt can be pr eset to a value by writing directly to it. pccnt is written to zero upon reset. 7.2.2 performance counter 0,1 - pcnt0, pcnt1 these counters monitor events as configured by pccr. when they reach 0xffff_ffff, they roll over. the overflow flag is set and an exception is generated if configured by pccr. the reg- isters can be reset by writing the r bit in pccr. the registers can be preset to a value by writing directly to them. pcnt0 and pcnt1 are written to zero upon reset. 7.2.3 performance counter control register - pccr this register controls the behaviour of the entire performance counter system, see figure 7-1 on page 57 . this register is read and written by the mtsr and mfsr instructions. pccr is written to zero upon reset. figure 7-1. performance counter control register e r c s ie - f - conf0 conf1 - 0 1 2 3 4 6 8 10 12 17 18 23 24 31
58 32000d?04/2011 avr32 the following fields exist in pccr, see table 7-1 on page 58 . table 7-1. performance counter control register bit access name description 23:18 read/write conf1 configures which events to count with pcnt1. see table 7-2 for a legend. 17:12 read/write conf0 configures which events to count with pcnt0. see table 7-2 for a legend. 10:8 read/write f interrupt flag. if read as 1, the corresponding overflow has occurred. bit 8 corresponds to pccnt. bit 9 corresponds to pcnt0. bit 10 corresponds to pcnt1. flags are cleared by writing a 1 to the flag. 6:4 read/write ie interrupt enable. if set, an overflow of the corresponding counter will cause an interrupt request. bit 4 corresponds to pccnt. bit 5 corresponds to pcnt0. bit 6 corresponds to pcnt1. 3 read/write s clock counter scaler. if set, t he clock counter increments once every 64?th clock cycle. this expands the period-to-overflow to 2 38 cycles. 2 read-0/write c clock counter reset. if written to 1, the clock counter will be reset. 1 read-0/write r performance counter reset. if written to 1, all three counters will be reset. 0 read/write e clock counter enable. if set, a ll three counters will count their configured events. if cleared, t he counters are disabled and will not count. other read-0/write- 0 - unused. read as 0. should be written as 0.
59 32000d?04/2011 avr32 7.3 monitorable events the following events can be monitored by the performance counters, depending on the setting of conf0 and conf1, see table 7-2 on page 59 . table 7-2. monitorable events configure field setting event monitored and counted 0x0 instruction cache miss. incremented on ce for each instruction fetch from a cacheable memory area that did not hit in the cache. 0x1 instruction fetch stage stall. incremented every cycle the memory system is unable to deliver an instruction to the cpu. 0x2 data hazard stall. incremented every cycle the condition is true. 0x3 itlb miss. 0x4 dtlb miss. 0x5 branch instruction executed. may or may not be taken. 0x6 branch mispredicted. 0x7 instruction executed. incremented once each time an instruction is completed. 0x8 stall due to data cache write buffers full. incremented once for each occurrence. 0x9 stall due to data cache write buffers full. incremented every cycle the condition is true. 0xa stall due to data cache read miss. incremented once for each data access to a cacheable memory area that did not hit in the cache. 0xb stall due to data cache read miss. incremented every cycl e the pipeline is stalled due to a data access to a cacheable memory area that did not hit in the cache. 0xc write access counter. incremented once for each write access. 0xd write access counter. incremented every cycle a write access is ongoing. 0xe read access counter. incremented once for each read access. 0xf read access counter. in cremented every cycle a read access is ongoing. 0x10 cache stall counter. incremented once for each read or write access that stalls. 0x11 cache stall counter. increm ented every cycle a read or write acce ss stalls. write accesses are counted only until the write is put in the write buffer. 0x12 cache access counter. incremented once for each read or write access. 0x13 cache access counter. incremented ev ery cycle a read or write access is ongoing. write accesses are counted only until the write is put in the write buffer. 0x14 data cache line writeback. incremented once when a line containing dirty data is replaced in the cache. 0x15 accumulator cache hit 0x16 accumulator cache miss 0x17 btb hit. incremented once per hit occurrence. 0x18 micro-itlb miss. incremented once per miss occurrence. 0x19 micro-dtlb miss. incremented once per miss occurrence. other reserved.
60 32000d?04/2011 avr32 7.4 usage the performance counters can be used to monitor several different events and perform different measurements. some of the most useful are explained below. 7.4.1 cycles per instruction conf0: 0x7 (instruction executed) cpi = ccnt / pcnt0 cycles-per-instruction (cpi) measures the aver age time it took to execute an instruction. 7.4.2 icache miss rate conf0: 0x7 (instruction executed) conf1: 0x0 (icache miss) icmr = pcnt1 / pcnt0 the instruction cache miss rate (icmr) mesu res the fraction of instruction cache misses per executed instruction. 7.4.3 dcache read miss rate conf0: 0xe (dcache read access) conf1: 0xa (dcache read miss) dcmr = pcnt1 / pcnt0 the data cache read miss rate (dcrmr) mesure s the fraction of data cache read misses per data cache read access. 7.4.4 average instruction fetch miss latency conf0: 0x1 (instruction fetch stall) conf1: 0x0 (icache miss) aifml = pcnt0 / pcnt1 the average instruction fetch miss latency (aifml) mesures the average number of clock cycles spent per instruction cache miss. this measur e does not consider cycles spent due to itlb misses. 7.4.5 fraction of execution time spent stalling due to instruction fetch misses conf0: 0x1 (instruction fetch stall) aifml = pcnt0 / pccnt the fraction of execution time spent stalling due to instruction fetch misses mesures the ratio of clock cycles spent waiting for an instruction to be fetched to the total number of execution cycles. 7.4.6 average writeback stall duration conf0: 0x8 (write buffer full occurrences) conf1: 0x9 (write buffer full cycles)
61 32000d?04/2011 avr32 awsd = pcnt0 / pcnt1 the average writeback stall duration (awsd) mesures the average number of clock cycles spent stalling due to a full writebuffer. 7.4.7 fraction of execution time spent stalling due to writeback conf0: 0x9 (write buffer full cycles) fetw=conf0/pccnt the fraction of execution time spent stalling due to writeback (fetw) is the ratio of writebuffer full stall cycles to the total number of cycles. 7.4.8 itlb miss rate conf0: 0x3 (itlb miss) conf1: 0x7 (instruction count) imr = pcnt0 / pcnt1 the itlb miss rate (imr) is the ratio of itlb misses to the number of instructions executed. 7.4.9 dtlb miss rate conf0: 0x4 (dtlb miss) conf1: 0x7 (instruction count) imr = pcnt0 / pcnt1 the dtlb miss rate (dmr) is the ratio of dtlb misses to the number of instructions executed. 7.4.10 branch prediction hit rate conf0: 0x17 (btb hit) conf1: 0x5 (branch executed) bphr = pcnt0 / pcnt1 the branch prediction hit rate (bphr) is the ratio of btb hits to the number of branches executed. 7.4.11 branch prediction correct rate conf0: 0x5 (branch executed) conf1: 0x6 (branch mispredicted) bpcr = pcnt1 / pcnt0 the branch prediction correct rate (bpcr) is the ratio of branch mispredictions to the total num- ber of executed branches.
62 32000d?04/2011 avr32
63 32000d?04/2011 avr32 8. event processing due to various reasons, the cpu may be required to abort normal program execution in order to handle special, high-priority events. when handling of these events is complete, normal program execution can be resumed. traditionally, events that are generated internally in the cpu are called exceptions, while events generated by sources external to the cpu are called interrupts. the possible sources of events are listed in table 8-1 on page 67 . the avr32 has a powerful event handling scheme. the different event sources, like illegal opcode and external interrupt requests, have different priority levels, ensuring a well-defined behaviour when multiple events are received simu ltaneously. additionally, pending events of a higher priority class may preempt handling of ongoing events of a lower priority class. when an event occurs, the execution of the instruction stream is halted, and execution control is passed to an event handler at an address specified in table 8-1 on page 67 . most of the han- dlers are placed sequentially in the code space starting at the address specified by evba, with four bytes between each handler. this gives am ple space for a jump instruction to be placed there, jumping to the event rout ine itself. a few critical handle rs have larger spacing between them, allowing the entire event routine to be placed directly at the address specified by the evba-relative offset generated by hardware. all external interrupt sources have autovectored interrupt service routine (isr) addresses. this allows the interrupt controller to directly specify the isr address as an address relative to evba. the address range reac hable by this autovec- tor offset is implementation defined. implementations ma y require evba to be aligned in an implementation defined way in order to support autovectoring. the same mechanisms are used to service all different types of events, including external inter- rupt requests, yielding a uniform event handling scheme. if the application is executing in the secure stat e, the event handling is modified as explained in ?event handling in secure state? on page 92 . this is to protect from hacking secure code using the event system. 8.1 event handling in avr32a 8.1.1 exceptions and interrupt requests when an event other than scall or debug request is received by the core, the following actions are performed atomically: 1. the pending event will no t be accepted if it is masked. the i3m, i2m, i1m, i0m, em and gm bits in the status register are used to mask different events. not all events can be masked. a few critical events (nmi, unrecove rable exception, tlb multiple hit and bus error) can not be masked. when an event is accepted, hardware automatically sets the mask bits corresponding to all sources with e qual or lower priority. this inhibits accep- tance of other events of the same or lower priority, except for the critical events listed above. software may choose to clear some or all of these bits after saving the neces- sary state if other priority schemes are desire d. it is the event sour ce?s responsability to ensure that their events are left pending until accepted by the cpu. 2. when a request is accepted, the status register and program counter of the current context is stored to the system stack. if the event is an int0, int1, int2 or int3, regis- ters r8 to r12 and lr are also automatically stored to stack. storing the status register ensures that the core is returned to the previous execution mode when the current event handling is completed. when exceptions occur, both the em and gm bits are set, and the application may manually enable nested exceptions if desired by clear-
64 32000d?04/2011 avr32 ing the appropriate bit. each exception handler has a dedicated handler address, and this address uniquely identifies the exception source. 3. the mode bits are set to reflect the priority of the accepted event, and the correct regis- ter file bank is selected. the address of the event handler, as shown in table 8-1, is loaded into the program counter. the execution of the event handler routine then continues from the effective address calculated. the rete instruction signals the end of the event. when encountered, the return status register and return address register are popped from the system stack and restored to the status reg- ister and program counter. if the rete instruction returns from int0, int1, int2 or int3, registers r8 to r12 and lr are also popped from the system stack. the restored status regis- ter contains information allowing the core to resume operation in the previous execution mode. this concludes the event handling. 8.1.2 supervisor calls the avr32 instruction set provides a supervisor mode call instruction. the scall instruction is designed so that privileged routines can be called from any context. this facilitates sharing of code between different execution modes. the scall mechanism is designed so that a minimal execution cycle overhead is experienced when performing supervisor routine calls from time- critical event handlers. the scall instruction behaves differently depending on which mode it is called from. the behav- iour is detailed in the instruction se t reference. in order to allow the scall routine to return to the correct context, a return from supervisor call instruction, rets , is implemented. in the avr32a microarchitecture, scall and rets uses the system stack to store the return address and the sta- tus register. 8.1.3 debug requests the avr32 architecture defines a dedicated debug mode. when a debug request is received by the core, debug mode is entered. entry into debug mode can be masked by the dm bit in the status register. upon entry into debug mode, hardware sets the sr[d] bit and jumps to the debug exception handler. by default, debug mode executes in the exception context, but with dedicated return address register and return status register. these dedicated registers remove the need for storing this data to the system stack, t hereby improving debuggability. the mode bits in the status register can freely be manipulated in debug mode, to observe registers in all contexts, while retaining full privileges. debug mode is exited by executing the retd instruction. this return s to the previous context. 8.2 event handling in avr32b 8.2.1 exceptions and interrupt requests when an event other than scall or debug request is received by the core, the following actions are performed atomically: 1. the pending event will no t be accepted if it is masked. the i3m, i2m, i1m, i0m, em and gm bits in the status register are used to mask different events. not all events can be masked. a few critical events (nmi, unrecove rable exception, tlb multiple hit and bus error) can not be masked. when an event is accepted, hardware automatically sets the mask bits corresponding to all sources with e qual or lower priority. this inhibits accep- tance of other events of the same or lower priority, except for the critical events listed above. software may choose to clear some or all of these bits after saving the neces-
65 32000d?04/2011 avr32 sary state if other priority schemes are desire d. it is the event sour ce?s responsability to ensure that their events are left pending until accepted by the cpu. 2. when a request is accepted, the status register and program counter of the current context is stored in the return status register and return address register corre- sponding to the new context. saving the status register ensures that the core is returned to the previous execution mode when the current event handling is completed. when exceptions occur, both the em and gm bits are set, and the application may manually enable nested exceptions if desired by clearing the appropriate bit. each exception handler has a dedicated handler address, and this address uniquely identi- fies the exception source. 3. the mode bits are set correctly to reflect the priority of the accepted event, and the cor- rect register file banks are selected. the address of the event handler, as shown in table 8-1, is loaded into the program counter. the execution of the event routine then continues from the effective address calculated. the rete instruction signals the end of the event. when encountered, the values in the return status register and return address register corresponding to the event context are restored to the status register and program counter. the restored status register contains information allowing the core to resume operation in the previous execution mode. this concludes the event handling. 8.2.2 supervisor calls the avr32 instruction set provides a supervisor mode call instruction. the scall instruction is designed so that privileged routines can be called from any context. this facilitates sharing of code between different execution modes. the scall mechanism is designed so that a minimal execution cycle overhead is experienced when performing supervisor routine calls from time- critical event handlers. the scall instruction behaves differently depending on which mode it is called from. the behav- iour is detailed in the instruction se t reference. in order to allow the scall routine to return to the correct context, a return from supervisor call instruction, rets , is implemented. 8.2.3 debug requests the avr32 architecture defines a dedicated debug mode. when a debug request is received by the core, debug mode is entered. entry into debug mode can be masked by the dm bit in the status register. upon entry into debug mode, hardware sets the sr[d] bit and jumps to the debug exception handler. by default, debug mode executes in the exception context, but with dedicated return address register and return status register. these dedicated registers remove the need for storing this data to the system stack, t hereby improving debuggability. the mode bits in the status register can freely be manipulated in debug mode, to observe registers in all contexts, while retaining full privileges. debug mode is exited by executing the retd instruction. this return s to the previous context.
66 32000d?04/2011 avr32 8.3 entry points for events several different event handler entry points exis ts. for avr32a, the reset routine is placed at address 0x8000_0000. this places the reset address in the flash memory area. for avr32b, the reset routine entry address is always fixed to 0xa000_0000. this address resides in unmapped, uncached space in order to ensure well-defined resets. tlb miss exceptions and scall have a dedicated space relative to evba where their event han- dler can be placed. this speeds up execution by removing the need for a jump instruction placed at the program address jumped to by the event hardware. all other exceptions have a dedicated event routine entry point located relative to evba. the handler routine address identifies the exception source directly. all external interrupt r equests have entry point s located at an offset relative to evba. this autovector offset is specified by an external interrupt controller. the programmer must make sure that none of the autovector offsets interfere with the placement of other code. the reach of the autovector offset is implementation defined. special considerations should be made when loading evba with a po inter. due to security con- siderations, the event handlers should be locate d in the privileged address space, or in a privileged memory protection region. in a system with mpu, the event routines could be placed in a cacheable protection region. in a segmented avr32b system, some segments of the virtual memory space may be better suited than others for holding event handlers. this is due to differ- ences in translateability and cacheability between segments. a cacheable, non-translated segment may offer the best performance for event handlers, as this will eliminate any tlb misses and speed up instruction fetch. the user may also consider to lock the event handlers in the instruction cache. if several events occur on the same instruction, they are handled in a prioritized way. the priority ordering is presented in table 8-1. if events occur on several instructions at different locations in the pipeline, the events on the oldest instruction are always handled before any events on any younger instruction, even if the younger instructi on has events of higher priority than the oldest instruction. an instruction b is younger than an in struction a if it was sent down the pipeline later than a. the addresses and priority of si multaneous events are shown in table 8-1 on page 67
67 32000d?04/2011 avr32 the interrupt system requires that an interrupt controller is presen t outside the co re in order to prioritize requests and generate a correct offset if more than one interrupt source exists for each priority level. an interrupt controller generating different offsets depending on interrupt request source is referred to as autovectoring. note that the interrupt controller should generate autovector addresses that do not conflict with addresses in use by other events or regular pro- gram code. table 8-1. priority and handler addresses for events priority handler address name event source stored return address 1 0x8000_0000 for avr32a. 0xa000_0000 for avr32b. reset external input undefined 2 provided by ocd system ocd stop cpu ocd system first non-compl eted instruction 3 evba+0x00 unrecoverable exception int ernal pc of offending instruction 4 evba+0x04 tlb multiple hit internal signal pc of offending instruction 5 evba+0x08 bus error data fetch data bu s first non-completed instruction 6 evba+0x0c bus error instruction fetch dat a bus first non-completed instruction 7 evba+0x10 nmi external input first non-completed instruction 8 autovectored interrupt 3 request external input first non-completed instruction 9 autovectored interrupt 2 request external input first non-completed instruction 10 autovectored interrupt 1 request external input first non-completed instruction 11 autovectored interrupt 0 request external input first non-completed instruction 12 evba+0x14 instruction address itlb pc of offending instruction 13 evba+0x50 itlb miss itlb pc of offending instruction 14 evba+0x18 itlb protection itlb pc of offending instruction 15 evba+0x1c breakpoint ocd system firs t non-completed instruction 16 evba+0x20 illegal opcode instructio n pc of offending instruction 17 evba+0x24 unimplemented instruction instr uction pc of offending instruction 18 evba+0x28 privilege violation instruc tion pc of offending instruction 19 evba+0x2c floating-point fp hardware pc of offending instruction 20 evba+0x30 coprocessor absent instruct ion pc of offending instruction 21 evba+0x100 supervisor call instru ction pc(supervisor call) +2 22 evba+0x34 data address (read) dtlb pc of offending instruction 23 evba+0x38 data address (write) dtl b pc of offending instruction 24 evba+0x60 dtlb miss (read) dtlb pc of offending instruction 25 evba+0x70 dtlb miss (write) dtlb pc of offending instruction 26 evba+0x3c dtlb protecti on (read) dtlb pc of offending instruction 27 evba+0x40 dtlb protection (write) d tlb pc of offending instruction 28 evba+0x44 dtlb modified dtlb pc of offending instruction
68 32000d?04/2011 avr32 the addresses of the interrupt routines are calculated by adding the address on the autovector offset bus to the value of the exception vector base address (evba). the int0, int1, int2, int3, and nmi signals indicate the priority of the pending interrupt. int0 has the lowest priority, and nmi the highest priority of the interrupts. implementations may require that evba is aligned in an implementation defined way in order to support autovectoring. 8.3.1 description of events in avr32a 8.3.1.1 reset exception the reset exception is generated when the reset input line to the cpu is asserted. the reset exception can not be masked by any bit. the reset exception resets all synchronous elements and registers in the cpu pipeline to their default value, and starts execution of instructions at address 0x8000_0000. sr = reset_value_of_sreg; pc = 0x8000_0000; all other system registers are reset to their reset value, which may or may not be defined. refer to the programming model chapter for details. 8.3.1.2 ocd stop cpu exception the ocd stop cpu exception is generated when the ocd stop cpu input line to the cpu is asserted. the ocd stop cpu exception can not be masked by any bit. this exception is identi- cal to a non-maskable, high priority breakpoint . any subsequent operation is controlled by the ocd hardware. the ocd hardware will take control over the cpu an d start to feed instructions directly into the pipeline. rsr_dbg = sr; rar_dbg = pc; sr[m2:m0] = b?110; sr[r] = 0; sr[j] = 0; sr[d] = 1; sr[dm] = 1; sr[em] = 1; sr[gm] = 1;
69 32000d?04/2011 avr32 8.3.1.3 unrecoverable exception the unrecoverable exception is generated when an exception request is issued when the exception mask (em) bit in the status register is asserted. the unrecoverable exception can not be masked by any bit. the unrecoverable exception is generated when a condition has occurred that the hardwa re cannot handle. the system will in mo st cases have to be restarted if this condition occurs. *(--sp sys ) = pc of offending instruction; *(--sp sys ) = sr; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x00; 8.3.1.4 tlb multiple hit exception tlb multiple hit exception is issued when multip le address matches occurs in the tlb, causing an internal inconsistency. this exception signals a critical error where the hardware is in an undefined state. all interrupts are masked, and pc is loaded with evba + 0x04 . mmu-related registers are updated with infor- mation in order to identify the failing address and the failing tlb if multiple tlbs are present. tlbehi[asid] is unchanged after the exception, and therefore identifies the asid that caused the exception. tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 0/1, depending on which tlb caused the error; *(--sp sys ) = pc of offending instruction; *(--sp sys ) = sr; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x04;
70 32000d?04/2011 avr32 8.3.1.5 bus error exception on data access the bus error on data access exception is generated when the data bus detects an error condi- tion. this exception is caused by events unrelated to the instruction stream, or by data written to the cache write-buffers many cycles ago. theref ore, execution can not be resumed in a safe way after this exception. the value placed in rar_ex is unrelated to the operation that caused the exception. the exception handler is responsible for performing the appropriate action. *(--sp sys ) = pc of first non-issued instruction; *(--sp sys ) = sr; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x08; 8.3.1.6 bus error exception on instruction fetch the bus error on instruction fetch exception is generated when the data bus detects an error condition. this exception is caus ed by events related to the instruction stream. therefore, exe- cution can be restarted in a safe way after th is exception, assuming that the condition that caused the bus error is dealt with. *(--sp sys ) = pc of first non-issued instruction; *(--sp sys ) = sr; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x0c; 8.3.1.7 nmi exception the nmi exception is generated when the nmi input line to the core is asserted. the nmi excep- tion can not be masked by the sr[gm] bit. however, the core ignores the nmi input line when processing an nmi exception (the sr[m2:m0] bits are b?111). th is guarantees serial execution of nmi exceptions, and simplifies the nmi hardware and software mechanisms. since the nmi exception is unrelated to the instruction stream, the instructions in the pipeline are allowed to complete. after finishing the nmi exception routine, execution should continue at the instruction following the last completed instruction in the instruction stream. *(--sp sys ) = pc of first noncompleted instruction; *(--sp sys ) = sr; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?111; sr[em] = 1; sr[gm] = 1; pc = evba + 0x10;
71 32000d?04/2011 avr32 8.3.1.8 int3 exception the int3 exception is generated when the int3 input line to the core is asserted. the int3 exception can be masked by the sr[gm] bit, and t he sr[i3m] bit. hardware automatically sets the sr[i3m] bit when accepting an int3 exception, inhibiting new int3 requests when process- ing an int3 request. the int3 exception handler address is calculated by adding evba to an interrupt vector offset specified by an interrupt controller outside the core. the interrupt controller is responsible for providing the correct offset. since the int3 exception is unrelated to the instruction stream, the instructions in the pipeline are allowed to complete. after finishing the int3 exception routine, execution should continue at the instruction following the last completed inst ruction in the instruction stream. *(--sp sys ) = r8; *(--sp sys ) = r9; *(--sp sys ) = r10; *(--sp sys ) = r11; *(--sp sys ) = r12; *(--sp sys ) = lr; *(--sp sys ) = pc of first noncompleted instruction; *(--sp sys ) = sr; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?101; sr[i3m] = 1; sr[i2m] = 1; sr[i1m] = 1; sr[i0m] = 1; pc = evba + interrupt_vector_offset; 8.3.1.9 int2 exception the int2 exception is generated when the int2 input line to the core is asserted. the int2 exception can be masked by the sr[gm] bit, and t he sr[i2m] bit. hardware automatically sets the sr[i2m] bit when accepting an int2 exception, inhibiting new int2 requests when process- ing an int2 request. the int2 exception handler address is calculated by adding evba to an interrupt vector offset specified by an interrupt controller outside the core. the interrupt controller is responsible for providing the correct offset. since the int2 exception is unrelated to the instruction stream, the instructions in the pipeline are allowed to complete. after finishing the int2 exception routine, execution should continue at the instruction following the last completed inst ruction in the instruction stream. *(--sp sys ) = r8; *(--sp sys ) = r9; *(--sp sys ) = r10; *(--sp sys ) = r11; *(--sp sys ) = r12; *(--sp sys ) = lr;
72 32000d?04/2011 avr32 *(--sp sys ) = pc of first noncompleted instruction; *(--sp sys ) = sr; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?100; sr[i2m] = 1; sr[i1m] = 1; sr[i0m] = 1; pc = evba + interrupt_vector_offset; 8.3.1.10 int1 exception the int1 exception is generated when the int1 input line to the core is asserted. the int1 exception can be masked by the sr[gm] bit, and t he sr[i1m] bit. hardware automatically sets the sr[i1m] bit when accepting an int1 exception, inhibiting new int1 requests when process- ing an int1 request. the int1 exception handler address is calculated by adding evba to an interrupt vector offset specified by an interrupt controller outside the core. the interrupt controller is responsible for providing the correct offset. since the int1 exception is unrelated to the instruction stream, the instructions in the pipeline are allowed to complete. after finishing the int1 exception routine, execution should continue at the instruction following the last completed inst ruction in the instruction stream. *(--sp sys ) = r8; *(--sp sys ) = r9; *(--sp sys ) = r10; *(--sp sys ) = r11; *(--sp sys ) = r12; *(--sp sys ) = lr; *(--sp sys ) = pc of first noncompleted instruction; *(--sp sys ) = sr; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?011; sr[i1m] = 1; sr[i0m] = 1; pc = evba + interrupt_vector_offset;
73 32000d?04/2011 avr32 8.3.1.11 int0 exception the int0 exception is generated when the int0 input line to the core is asserted. the int0 exception can be masked by the sr[gm] bit, and t he sr[i0m] bit. hardware automatically sets the sr[i0m] bit when accepting an int0 exception, inhibiting new int0 requests when process- ing an int0 request. the int0 exception handler address is calculated by adding evba to an interrupt vector offset specified by an interrupt controller outside the core. the interrupt controller is responsible for providing the correct offset. since the int0 exception is unrelated to the instruction stream, the instructions in the pipeline are allowed to complete. after finishing the int0 exception routine, execution should continue at the instruction following the last completed inst ruction in the instruction stream. *(--sp sys ) = r8; *(--sp sys ) = r9; *(--sp sys ) = r10; *(--sp sys ) = r11; *(--sp sys ) = r12; *(--sp sys ) = lr; *(--sp sys ) = pc of first noncompleted instruction; *(--sp sys ) = sr; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?010; sr[i0m] = 1; pc = evba + interrupt_vector_offset; 8.3.1.12 instruction address exception the instruction address error exception is generated if the generated instruction memory address has an illegal alignment. *(--sp sys ) = pc; *(--sp sys ) = sr; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x14;
74 32000d?04/2011 avr32 8.3.1.13 itlb miss exception the itlb miss exception is generated when no tlb entry matches the instruction memory address, or if the valid bit in a matching entry is 0. *(--sp sys ) = pc; *(--sp sys ) = sr; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 1; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x50; 8.3.1.14 itlb protection exception the itlb protection exception is generated when the instruction memory access violates the access rights specified by the protecti on bits of the addressed virtual page. *(--sp sys ) = pc; *(--sp sys ) = sr; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 1; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x18;
75 32000d?04/2011 avr32 8.3.1.15 breakpoint exception the breakpoint excepti on is issued when a breakpoint instruction is executed, or the ocd breakpoint input line to the cpu is asserted, and sreg[dm] is cleared. an external debugger can optionally assume cont rol of the cpu when the breakpoint exception is executed. the debugger can then issue individual instructions to be executed in debug mode. debug mode is exited with the retd instruction. this passes control from the debugger back to the cpu, resuming normal execution. rsr_dbg = sr; rar_dbg = pc; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[d] = 1; sr[dm] = 1; sr[em] = 1; sr[gm] = 1; pc = evba + 0x1c; 8.3.1.16 illegal opcode this exception is issued when the core fetches an unknown instruction, or when a coprocessor instruction is not acknowledged. when entering the exception routine, the return address on stack points to the instruction that caused the exception. *(--sp sys ) = pc; *(--sp sys ) = sr; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x20; 8.3.1.17 unimplemented instruction this exception is issued when the core fetches an instruction supported by the instruction set but not by the current implementation. this allows software implementations of unimplemented instructions. when entering the exception routine, the return address on stack points to the instruction that caused the exception. *(--sp sys ) = pc; *(--sp sys ) = sr; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x24;
76 32000d?04/2011 avr32 8.3.1.18 data read address exception the data read address error exception is generated if the address of a data memory read has an illegal alignment. *(--sp sys ) = pc; *(--sp sys ) = sr; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x34; 8.3.1.19 data write address exception the data write address error exception is generated if the address of a data memory write has an illegal alignment. *(--sp sys ) = pc; *(--sp sys ) = sr; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x38; 8.3.1.20 dtlb read miss exception the dtlb read miss exception is generated when no tlb entry matches the data memory address of the current read operation, or if the valid bit in a matching entry is 0. *(--sp sys ) = pc; *(--sp sys ) = sr; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 0; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x60;
77 32000d?04/2011 avr32 8.3.1.21 dtlb write miss exception the dtlb write miss excepti on is generated when no tlb entry matches the data memory address of the current write operation, or if the valid bit in a matching entry is 0. *(--sp sys ) = pc; *(--sp sys ) = sr; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 0; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x70; 8.3.1.22 dtlb read protection exception the dtlb protection exception is generated when the data memory read violates the access rights specified by the protection bits of the addressed virtual page. *(--sp sys ) = pc; *(--sp sys ) = sr; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 0; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x3c; 8.3.1.23 dtlb write protection exception the dtlb protection exception is generated when the data memory write violates the access rights specified by the protection bits of the addressed virtual page. *(--sp sys ) = pc; *(--sp sys ) = sr; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 0; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x40;
78 32000d?04/2011 avr32 8.3.1.24 privilege violation exception if the application tries to execute privileged instru ctions, this exception is issued. the complete list of priveleged inst ructions is shown in table 8-2 on page 78 . when entering the exception routine, the address of the instruction that caus ed the exception is stored as the stacked return address. *(--sp sys ) = pc; *(--sp sys ) = sr; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x28; table 8-2. list of instructions which can only execute in privileged modes. privileged instructions comment csrf - clear status register flag privileged onl y when accessing upper half of status register cache - perform cache operation tlbr - read addressed tlb entry into tlbehi and tlbelo tlbw - write tlb entry registers into tlb tlbs - search tlb for entry matching tlbehi[vpn] mtsr - move to system register unpriviledged when accessing josp and jecr mfsr - move from system register unpriviledged when accessing josp and jecr mtdr - move to debug register mfdr - move from debug register rete- return from exception rets - return from supervisor call retd - return from debug mode sleep - sleep ssrf - set status register flag privileged only when accessing upper half of status register
79 32000d?04/2011 avr32 8.3.1.25 dtlb modified exception the dtlb modified exception is generated when a data memory write hits a valid tlb entry, but the dirty bit of the entry is 0. this indicates that the page is not writable. *(--sp sys ) = pc; *(--sp sys ) = sr; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 0; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x44; 8.3.1.26 floating-point exception the floating-point exception is generated when the optional floating-point hardware signals that an ieee exception occurred, or when another type of error from the floating-point hardware occurred.. *(--sp sys ) = pc; *(--sp sys ) = sr; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x2c; 8.3.1.27 coprocessor exception the coprocessor exception occurs when the a ddressed coprocessor does not acknowledge an instruction. this permits software implementation of coprocessors. *(--sp sys ) = pc; *(--sp sys ) = sr; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x30;
80 32000d?04/2011 avr32 8.3.1.28 supervisor call supervisor calls are signalled by the application code executing a supervisor call ( scall ) instruc- tion. the scall instruction behaves differently depending on which context it is called from. this allows scall to be called from other contexts than application. when the exception routine is finished, execution continues at the instruction following scall . the rets instruction is used to return from supervisor calls. if ( sr[m2:m0] == {b?000 or b?001} ) *(--sp sys ) = pc; *(--sp sys ) = sr; pc evba + 0x100; sr[m2:m0] b?001; else lr current context pc + 2; pc evba + 0x100;
81 32000d?04/2011 avr32 8.3.2 description of events in avr32b 8.3.2.1 reset exception the reset exception is generated when the reset input line to the cpu is asserted. the reset exception can not be masked by any bit. the reset exception resets all synchronous elements and registers in the cpu pipeline to their default value, and starts execution of instructions at address 0xa000_0000. sr = reset_value_of_sreg; pc = 0xa000_0000; all other system registers are reset to their reset value, which may or may not be defined. refer to the programming model chapter for details. 8.3.2.2 ocd stop cpu exception the ocd stop cpu exception is generated when the ocd stop cpu input line to the cpu is asserted. the ocd stop cpu exception can not be masked by any bit. this exception is identi- cal to a non-maskable, high priority breakpoint . any subsequent operation is controlled by the ocd hardware. the ocd hardware will take control over the cpu an d start to feed instructions directly into the pipeline. rsr_dbg = sr; rar_dbg = pc; sr[m2:m0] = b?110; sr[r] = 0; sr[j] = 0; sr[d] = 1; sr[dm] = 1; sr[em] = 1; sr[gm] = 1; 8.3.2.3 unrecoverable exception the unrecoverable exception is generated when an exception request is issued when the exception mask (em) bit in the status register is asserted. the unrecoverable exception can not be masked by any bit. the unrecoverable exception is generated when a condition has occurred that the hardwa re cannot handle. the system will in mo st cases have to be restarted if this condition occurs. rsr_ex = sr; rar_ex = pc of offending instruction; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x00;
82 32000d?04/2011 avr32 8.3.2.4 tlb multiple hit exception tlb multiple hit exception is issued when multip le address matches occurs in the tlb, causing an internal inconsistency. this exception signals a critical error where the hardware is in an undefined state. all interrupts are masked, and pc is loaded with evba + 0x04 . mmu-related registers are updated with infor- mation in order to identify the failing address and the failing tlb if multiple tlbs are present. tlbehi[asid] is unchanged after the exception, and therefore identifies the asid that caused the exception. rsr_ex = sr; rar_ex = pc of offending instruction; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 0/1, depending on which tlb caused the error; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x04; 8.3.2.5 bus error exception on data access the bus error on data access exception is generated when the data bus detects an error condi- tion. this exception is caused by events unrelated to the instruction stream, or by data written to the cache write-buffers many cycles ago. theref ore, execution can not be resumed in a safe way after this exception. the value placed in rar_ex is unrelated to the operation that caused the exception. the exception handler is responsible for performing the appropriate action. rsr_ex = sr; rar_ex = pc of first non-issued instruction; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x08; 8.3.2.6 bus error exception on instruction fetch the bus error on instruction fetch exception is generated when the data bus detects an error condition. this exception is caus ed by events related to the instruction stream. therefore, exe- cution can be restarted in a safe way after th is exception, assuming that the condition that caused the bus error is dealt with. rsr_ex = sr; rar_ex = pc; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1;
83 32000d?04/2011 avr32 sr[gm] = 1; pc = evba + 0x0c; 8.3.2.7 nmi exception the nmi exception is generated when the nmi input line to the core is asserted. the nmi excep- tion can not be masked by the sr[gm] bit. however, the core ignores the nmi input line when processing an nmi exception (the sr[m2:m0] bits are b?111). th is guarantees serial execution of nmi exceptions, and simplifies the nmi hardware and software mechanisms. since the nmi exception is unrelated to the instruction stream, the instructions in the pipeline are allowed to complete. after finishing the nmi exception routine, execution should continue at the instruction following the last completed instruction in the instruction stream. rsr_nmi = sr; rar_nmi = address of first noncompleted instruction; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?111; sr[em] = 1; sr[gm] = 1; pc = evba + 0x10; 8.3.2.8 int3 exception the int3 exception is generated when the int3 input line to the core is asserted. the int3 exception can be masked by the sr[gm] bit, and t he sr[i3m] bit. hardware automatically sets the sr[i3m] bit when accepting an int3 exception, inhibiting new int3 requests when process- ing an int3 request. the int3 exception handler address is calculated by adding evba to an interrupt vector offset specified by an interrupt controller outside the core. the interrupt controller is responsible for providing the correct offset. since the int3 exception is unrelated to the instruction stream, the instructions in the pipeline are allowed to complete. after finishing the int3 exception routine, execution should continue at the instruction following the last completed inst ruction in the instruction stream. rsr_int3 = sr; rar_int3 = address of first noncompleted instruction; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?101; sr[i3m] = 1; sr[i2m] = 1; sr[i1m] = 1; sr[i0m] = 1; pc = evba + interrupt_vector_offset;
84 32000d?04/2011 avr32 8.3.2.9 int2 exception the int2 exception is generated when the int2 input line to the core is asserted. the int2 exception can be masked by the sr[gm] bit, and t he sr[i2m] bit. hardware automatically sets the sr[i2m] bit when accepting an int2 exception, inhibiting new int2 requests when process- ing an int2 request. the int2 exception handler address is calculated by adding evba to an interrupt vector offset specified by an interrupt controller outside the core. the interrupt controller is responsible for providing the correct offset. since the int2 exception is unrelated to the instruction stream, the instructions in the pipeline are allowed to complete. after finishing the int2 exception routine, execution should continue at the instruction following the last completed inst ruction in the instruction stream. rsr_int2 = sr; rar_int2 = address of first noncompleted instruction; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?100; sr[i2m] = 1; sr[i1m] = 1; sr[i0m] = 1; pc = evba + interrupt_vector_offset; 8.3.2.10 int1 exception the int1 exception is generated when the int1 input line to the core is asserted. the int1 exception can be masked by the sr[gm] bit, and t he sr[i1m] bit. hardware automatically sets the sr[i1m] bit when accepting an int1 exception, inhibiting new int1 requests when process- ing an int1 request. the int1 exception handler address is calculated by adding evba to an interrupt vector offset specified by an interrupt controller outside the core. the interrupt controller is responsible for providing the correct offset. since the int1 exception is unrelated to the instruction stream, the instructions in the pipeline are allowed to complete. after finishing the int1 exception routine, execution should continue at the instruction following the last completed inst ruction in the instruction stream. rsr_int1 = sr; rar_int1 = address of first noncompleted instruction; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?011; sr[i1m] = 1; sr[i0m] = 1; pc = evba + interrupt_vector_offset;
85 32000d?04/2011 avr32 8.3.2.11 int0 exception the int0 exception is generated when the int0 input line to the core is asserted. the int0 exception can be masked by the sr[gm] bit, and t he sr[i0m] bit. hardware automatically sets the sr[i0m] bit when accepting an int0 exception, inhibiting new int0 requests when process- ing an int0 request. the int0 exception handler address is calculated by adding evba to an interrupt vector offset specified by an interrupt controller outside the core. the interrupt controller is responsible for providing the correct offset. since the int0 exception is unrelated to the instruction stream, the instructions in the pipeline are allowed to complete. after finishing the int0 exception routine, execution should continue at the instruction following the last completed inst ruction in the instruction stream. rsr_int0 = sr; rar_int0 = address of first noncompleted instruction; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?010; sr[i0m] = 1; pc = evba + interrupt_vector_offset; 8.3.2.12 instruction address exception the instruction address error exception is generated if the generated instruction memory address has an illegal alignment. rsr_ex = sr; rar_ex = pc; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x14;
86 32000d?04/2011 avr32 8.3.2.13 itlb miss exception the itlb miss exception is generated when no tlb entry matches the instruction memory address, or if the valid bit in a matching entry is 0. rsr_ex = sr; rar_ex = pc; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 1; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x50; 8.3.2.14 itlb protection exception the itlb protection exception is generated when the instruction memory access violates the access rights specified by the protecti on bits of the addressed virtual page. rsr_ex = sr; rar_ex = pc; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 1; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x18; 8.3.2.15 breakpoint exception the breakpoint excepti on is issued when a breakpoint instruction is executed, or the ocd breakpoint input line to the cpu is asserted, and sreg[dm] is cleared. an external debugger can optionally assume cont rol of the cpu when the breakpoint exception is executed. the debugger can then issue individual instructions to be executed in debug mode. debug mode is exited with the retd instruction. this passes control from the debugger back to the cpu, resuming normal execution. rsr_dbg = sr; rar_dbg = pc; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[d] = 1; sr[dm] = 1;
87 32000d?04/2011 avr32 sr[em] = 1; sr[gm] = 1; pc = evba + 0x1c; 8.3.2.16 illegal opcode this exception is issued when the core fetches an unknown instruction, or when a coprocessor instruction is not acknowledged. when entering the exception routine, the return address on stack points to the instruction that caused the exception. rsr_ex = sr; rar_ex = pc; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x20; 8.3.2.17 unimplemented instruction this exception is issued when the core fetches an instruction supported by the instruction set but not by the current implementation. this allows software implementations of unimplemented instructions. when entering the exception routine, the return address on stack points to the instruction that caused the exception. rsr_ex = sr; rar_ex = pc; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x24; 8.3.2.18 data read address exception the data read address error exception is generated if the address of a data memory read has an illegal alignment. rsr_ex = sr; rar_ex = pc; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x34;
88 32000d?04/2011 avr32 8.3.2.19 data write address exception the data write address error exception is generated if the address of a data memory write has an illegal alignment. rsr_ex = sr; rar_ex = pc; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x38; 8.3.2.20 dtlb read miss exception the dtlb read miss exception is generated when no tlb entry matches the data memory address of the current read operation, or if the valid bit in a matching entry is 0. rsr_ex = sr; rar_ex = pc; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 0; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x60; 8.3.2.21 dtlb write miss exception the dtlb write miss excepti on is generated when no tlb entry matches the data memory address of the current write operation, or if the valid bit in a matching entry is 0. rsr_ex = sr; rar_ex = pc; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 0; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x70;
89 32000d?04/2011 avr32 8.3.2.22 dtlb read protection exception the dtlb protection exception is generated when the data memory read violates the access rights specified by the protection bits of the addressed virtual page. rsr_ex = sr; rar_ex = pc; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 0; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x3c; 8.3.2.23 dtlb write protection exception the dtlb protection exception is generated when the data memory write violates the access rights specified by the protection bits of the addressed virtual page. rsr_ex = sr; rar_ex = pc; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 0; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x40; 8.3.2.24 privilege violation exception if the application tries to execute privileged instru ctions, this exception is issued. the complete list of priveleged instructions is shown in table 8-2. when entering the exception routine, the address of the instruction that caused the exception is stored as yhe stacked return address. rsr_ex = sr; rar_ex = pc; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x28;
90 32000d?04/2011 avr32 8.3.2.25 dtlb modified exception the dtlb modified exception is generated when a data memory write hits a valid tlb entry, but the dirty bit of the entry is 0. this indicates that the page is not writable. rsr_ex = sr; rar_ex = pc; tlbear = failing_virtual_address; tlbehi[vpn] = failing_page_number; tlbehi[i] = 0; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x44; table 8-3. list of instructions which can only execute in privileged modes. privileged instructions comment csrf - clear status register flag privileged only when accessing upper half of status register cache - perform cache operation tlbr - read addressed tlb entry into tlbehi and tlbelo tlbw - write tlb entry registers into tlb tlbs - search tlb for entry matching tlbehi[vpn] mtsr - move to system register unpriviledged when accessing josp and jecr mfsr - move from system register unpriviledged when accessing josp and jecr - move to debug register mfdr - move from debug register rete- return from exception rets - return from supervisor call retd - return from debug mode sleep - sleep ssrf - set status register flag privileged only when accessing upper half of status register
91 32000d?04/2011 avr32 8.3.2.26 floating-point exception the floating-point exception is generated when the optional floating-point hardware signals that an ieee exception occurred, or when another type of error from the floating-point hardware occurred.. rsr_ex = sr; rar_ex = pc; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x2c; 8.3.2.27 coprocessor exception the coprocessor exception occurs when the a ddressed coprocessor does not acknowledge an instruction. this permits software implementation of coprocessors. rsr_ex = sr; rar_ex = pc; sr[r] = 0; sr[j] = 0; sr[m2:m0] = b?110; sr[em] = 1; sr[gm] = 1; pc = evba + 0x30; 8.3.2.28 supervisor call supervisor calls are signalled by the application code executing a supervisor call ( scall ) instruc- tion. the scall instruction behaves differently depending on which context it is called from. this allows scall to be called from other contexts than application. when the exception routine is finished, execution continues at the instruction following scall . the rets instruction is used to return from supervisor calls. if ( sr[m2:m0] == {b?000 or b?001} ) rar_sup pc + 2; rsr_sup sr; pc evba + 0x100; sr[m2:m0] b?001; else lr current context pc + 2; pc evba + 0x100;
92 32000d?04/2011 avr32 8.4 event priority several instructions may be in the pipeline at the same time, and several events may be issued in each pipeline stage. this implies that several pending exceptions may be in the pipeline simultaneously. priorities must therefore be impo sed, ensuring that the correct event is serviced first. the priority scheme obeys the following rules: 1. if several instructions trigger events, the instruction furthest down the pipeline is ser- viced first, even if upstream instructions have pending events of higher priority. 2. if this instruction has several pending events, the event with the highest priority is ser- viced first. after this event has been serviced, all pending events are cleared and the instruction is restarted. details about the timing of events is implementation defined, and given in the hardware manual for the specific implementation. 8.5 event handling in secure state interrupt and exception handling in avr32a and avr32b has been described in the previous chapters. this behavior is modified in the following way when interrupts and exceptions are received in secure state: a sscall instruction will set sr[gm]. in secure st ate, sr[gm] masks bo th int0-int3, and nmi. clearing sr[gm], int0-int3 and nmi will re move the mask of th ese event sources. int0-int3 are still additionally masked by the i0m-i3 m bits in the status register.  sscall has handler address at offset 0x4 relative to the reset handler address.  exceptions have a handler address at offset 0x8 relative to the reset handler address.  nmi has a handler address at offset 0xc relative to the reset handler address.  breakpoint has a handler address at offset 0x10 relative to the reset handler address.  int0-int3 are not autovectored, but have a common handler address at offset 0x14 relative to the reset handler address. note that in the secure state, all exception sources share the same handler address. it is there- fore not possible to separate different exception causes when in the secure world. the secure world system must be designed to support this, the most obvious solution is to design the secure software so that e xceptions will not arise.
93 32000d?04/2011 avr32 9. avr32 risc instruction set 9.1 instruction set nomenclature 9.1.1 registers and operands r {d, s, ?} the uppercase ? r ? denotes a 32-bit (word) register. r d the lowercase ? d ? denotes the destination register number. r s the lowercase ? s ? denotes the source register number. r x the lowercase ? x ? denotes the first source register number for three reg- ister operations. r y the lowercase ? y ? denotes the second source register number for three register operations. r b the lowercase ? b ? denotes the base register number for indexed addressing modes. r i the lowercase ? i ? denotes the index register number for indexed addressing modes. r p the lowercase ? p ? denotes the pointer register number. pc program counter, equal to r15 lr link register, equal to r14 sp stack pointer, equal to r13 reglist8 reglist8 {r0-r3, r4-r7, r8-r9, r10, r11, r12, lr, pc} reglist16 reglist16 {r0, r1, r2, ..., r12, lr, sp, pc} reglistcph8 reglistcph8 {cr8, cr9, cr10, ..., cr15} reglistcpl8 reglistcpl8 {cr0, cr1, cr2, ..., cr7} reglistcp8 reglistcpd8 {cr0-cr1,cr2-cr3,cr4- cr5,cr6-cr7,cr8-cr9, cr10-cr11,cr12-cr13,cr14-cr15} sysregname name of source or destination system register. cond3 cond3 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl} cond4 cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} disp displacement disp :e displacement of n bits. if the both compact and extended versions of the instruction exists, then use the extended version. the compact version is used by default. imm immediate value imm :e immediate of n bits. if the both compact and extended versions of the instruction exists, then use the extended version. the compact version is used by default. sa shift amount bp bit postion w width of a bit field [i] denotes bit i in a immediate value. example: imm6[4] denotes bit 4 in an 6-bit immediate value.
94 32000d?04/2011 avr32 [i:j] denotes bit i to j in an immediate value. some instructions access or use doubleword operands. these operands must be placed in two consecutive register addresses where the first register must be an even register. the even register contains the least significant part and the odd register con- tains the most significant part. this ordering is reversed in comparison with how data is organized in memory (where the most significant part would receive the lowest address) and is intentional. the programmer is responsible for placing th ese operands in properly aligned register pairs. this is also specified in the "operands" section in the de tailed description of ea ch instruction. fail- ure to do so will result in an undefined behaviour. 9.1.2 operator symbols bitwise logical and operation. bitwise logical or operation. ? bitwise logical eor operation. ? bitwise logical not operation. sat saturate operand 9.1.3 operations asr(x, n) se(x, bits(x) + n) >> n bits(x) number of bits in operand x lsr(x, n) x >> n lsl(x, n) x << n sats(x, n) signed saturation ( x is treated as a signed value ): if (x > (2 n-1 -1)) then (2 n-1 -1); elseif (x < -2 n-1 ) then -2 n-1 ; else x; satsu(x, n) signed to unsigned saturation ( x is treated as a signed value ): if (x > (2 n -1)) then (2 n-1 -1); elseif ( x < 0 ) then 0; else x; satu(x, n) unsigned saturation ( x is treated as an unsigned value ): if (x > (2 n -1)) then (2 n-1 -1); else x; se(x, n) sign extend x to an n-bit value se(x) identical to se(x, 32) ze(x, n) zero extend x to an n-bit value ze(x) identical to ze(x, 32) 9.1.4 status register flags c : carry / borrow flag. z: zero flag, set if the result of the operation is zero. n : bit 31 of the result. v: set if 2?s complement overflow occurred. q: saturated flag, set if saturation and/or overflow has occurred after some instructions. m0 : mode bit 0
95 32000d?04/2011 avr32 m1 : mode bit 1 m2 : mode bit 2 9.1.5 data type extensions .d double (64-bit) operation. .w word (32-bit) operation. .h halfword (16-bit) operation. .b byte operation (8-bit) operation. 9.1.6 halfword selectors t top halfword, bits 31-16. b bottom halfword, bits 15-0. 9.1.7 byte selectors t top byte, bits 31-24. u upper byte, bits 23-16. l lower byte, bits 15-8. b bottom byte, bits 7-0. 9.1.8 cpu system registers rsr_int0 : interrupt level 0 r eturn s tatus r egister. rsr_int1 : interrupt level 1 r eturn s tatus r egister. rsr_int2 : interrupt level 2 r eturn s tatus r egister. rsr_int3 : interrupt level 3 r eturn s tatus r egister. rsr_ex : exception r eturn s tatus r egister. rsr_nmi : non maskable interrupt r eturn s tatus r egister. rsr_sup : supervisor r eturn s tatus r egister. rar_int0 : interrupt level 0 r eturn a ddress r egister. rar_int1 : interrupt level 1 r eturn a ddress r egister. rar_int2 : interrupt level 2 r eturn a ddress r egister. rar_int3 : interrupt level 3 r eturn a ddress r egister. rar_ex : exception r eturn a ddress r egister. rar_nmi : non maskable interrupt r eturn a ddress r egister. rar_sup : supervisor r eturn a ddress r egister. acba : a pplication c all b ase a ddress register. evba : e xception v ector b ase a ddress register.
96 32000d?04/2011 avr32 9.1.9 branch conditions table 9-1. branch conditions coding in cond3 coding in cond4 condition mnemonic evaluated expression numerical format meaning b?000 b?0000 eq z equal b?001 b?0001 ne ? z not equal b?010 b?0010 cc / hs ? c unsigned higher or same b?011 b?0011 cs / lo c unsigned lower b?100 b?0100 ge n == v signed greater than or equal b?101 b?0101 lt n v signed less than b?110 b?0110 mi n signed minus / negative b?111 b?0111 pl ? n signed plus / positive n/a b?1000 ls c z unsigned lower or same n/a b?1001 gt ? z (n==v) signed greater than n/a b?1010 le z (n v) signed less than or equal n/a b?1011 hi ? c ? z unsigned higher n/a b?1100 vs v overflow n/a b?1101 vc ? v no overflow n/a b?1110 qs q fractional saturation n/a b?1111 al true always
97 32000d?04/2011 avr32 9.2 instruction formats this is an overview of the different instruction formats. 9.2.1 two register instructions 9.2.2 single register instructions 9.2.3 return and test 9.2.4 k8 immediate and single register 9.2.5 sp / pc relative load / store 9.2.6 k5 immediate and single register 9.2.7 displacement load with k5 immediate 9.2.8 displacement load / store with k3 immediate opcod rs/rp opcode rd/rs 15 13 12 9 8 4 3 0 0101110 opcode rd 15 13 12 9 8 4 3 0 0101111opc cond4 rs/rd 15 1312 987 43 0 001opc k8 rd 15 13 12 11 4 3 0 0 1 0 opcode k7 rd/rs 15 13 12 11 10 4 3 0 010110opc k5 rd 15 13 12 10 9 8 4 3 0 0 1 1 rp k5 rd 15 13 12 9 8 4 3 0 1 0 0 rp opcode k3 rd/rs 15141312 9876 43 0
98 32000d?04/2011 avr32 9.2.9 one register and a register pair 9.2.10 one register with k8 immediate and cond4 9.2.11 one register with bit addressing 9.2.12 short branch 9.2.13 relative jump and call 9.2.14 k8 and no register 9.2.15 multiple registers (popm) 9.2.16 multiple registers (pushm) 9.2.17 status register bit specification 101 rp 100 opc rd/rs opc 15 1312 98 6543 10 111 opcode 11011 rd 31 29 28 25 24 20 19 16 0000 cond4 k8 15 12 11 8 7 0 1 0 1 bit[4:1] opcode bit[0] rd 15 1312 98 543 0 1100 k8 0 cond3 15 13 12 11 4 3 2 0 1100 k10[7:0] 1opck10[9:8] 15 131211 43210 1101 k8/label 000opc 15 12 11 4 3 1 0 1101pclr1211109-87-43-0k 01 0 15 3 2 0 1101pclr1211109-87-43-0001 1 15 13 12 11 4 3 0 11010opcode bit no 0100 15 11 10 9 8 4 3 0
99 32000d?04/2011 avr32 9.2.18 only opcode 9.2.19 3 registers shifted 9.2.20 3 registers unshifted 9.2.21 dsp halfword multiply 9.2.22 dsp word and halfword multiply 9.2.23 2 register operands with k8 immediate 1101011 opcode 010 0 15 98 43 0 111 rb/rx 00000 ry/ri 31 29 28 25 24 20 19 16 0000 opcode 00 shift amount rd/rs 15 12 11 8 7 6 5 4 3 0 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000 opcode rd 15 12 11 4 3 0 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000 opcode 00xy rd 15 12 11 8 7 6 5 4 3 0 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000 opcode 100y rd 15 12 11 8 7 5 4 3 0 111 rs 00000 rd 31 29 28 25 24 20 19 16 0001 opcode k8 15 12 11 8 7 0
100 32000d?04/2011 avr32 9.2.24 2 register operands with k5 immediate 9.2.25 2 registers with w5 and o5 9.2.26 coprocessor 0 load and store 9.2.27 2 register operands 9.2.28 register operand with k16 9.2.29 cache operation 111 rs 00000 rd 31 29 28 25 24 20 19 16 0001 opcode 000 k5 15 12 11 8 7 5 4 0 111 rd 11101 rs 31 29 28 25 24 20 19 16 opcode o5 w5 15 10 9 5 4 0 1111 opc 11010 rp 31 29 28 26 25 24 20 19 16 k12 [11:8] crd/crs k12[7:0] 15 13 12 11 8 7 6 0 111 rs 00000 rd 31 29 28 25 24 20 19 16 0001 opcode 00000000 15 12 11 8 7 0 1 1 1 opcode rd/rp 31 29 28 20 19 16 k16 15 0 1111 1000001 rp 31 20 19 16 op5 k11 15 0 0
101 32000d?04/2011 avr32 9.2.30 register or condition code and k21 9.2.31 no register and k21 9.2.32 two registers and k16 9.2.33 register, doubleword register and k16 9.2.34 k16 and bit address 9.2.35 coprocessor operation 1 1 1 k21[20:17] opcode k21 rd/cond 31 29 28 25 24 21 20 19 16 k21[15:0] 15 0 [16] 1 1 1 k[20:17] opcode k21 opcode 31 29 28 25 24 21 20 19 16 k21[15:0] 15 0 [16] 1 1 1 rs/rp opcode rd/rs 31 29 28 25 24 20 19 16 k16 15 0 1 1 1 rs/rp opcode rd/rs opc 31 29 28 25 24 20 19 16 k16 15 0 1110 0bit[4]11001 bit[3:0] 31 29 28 26 25 24 20 19 16 k16 15 0 0 11100 op[5:4]11010 op[3:0] 31 29 28 25 24 20 19 16 cp# op[6] crd crx cry 15 0
102 32000d?04/2011 avr32 9.2.36 coprocessor load and store 9.2.37 coprocessor load and store multiple registers 9.2.38 coprocessor load, store and move 9.2.39 coprocessor load and store with indexed addressing 9.2.40 register and system register 9.2.41 sleep and sync 1110 0opc11010 rp 31 29 28 26 25 24 20 19 16 cp # opc crd/crs k8 15 13 12 11 8 7 6 0 1 1110 1011010 rp 31 29 28 25 24 20 19 16 cp # ++/-- 0 opcode cr 14- 15 13 12 11 10 9 8 7 0 1 cr 13- cr 11- cr 9-8 cr 7-6 cr 5-4 cr 3-2 cr 1-0 1110 1111010 rd/rs/rp 31 29 28 25 24 20 19 16 cp# opc crs/crd 0 opc 0 0 0 15 13 12 11 8 7 6 4 3 0 1 0 1110 1111010 rp 31 29 28 25 24 20 19 17 16 cp# opc crs/crd opc k k i3 15 13 12 11 9 8 7 6 5 4 3 0 1 111000opc11011 rd/rs 31 20 19 16 00000000 system register ad- 15 8 7 0 111 opcode 110110 00 31 29 28 25 24 20 19 16 00000000 op8 15 8 7 0 0
103 32000d?04/2011 avr32 9.2.42 register and bit address 9.2.43 load and store multiple registers 9.2.44 register, k12 and halfword select 9.2.45 register, k12 and byte select 9.2.46 2 register and k12 9.2.47 andl / andh 111 opcode 11011 rd 31 29 28 25 24 20 19 16 00000000000 bit number 15 5 4 0 111 opcode ++/--11100 rp 31 29 28 26 25 24 20 19 16 r15 r14 r13 r12 r11 r10 r9 r8 r7 r6 r5 r4 r3 r2 r1 r0 15 0 111 rp 11101 rd 31 29 28 25 24 20 19 16 0 0 part k12 15 14 13 12 11 0 0 111 rp 11101 rd 31 29 28 25 24 20 19 16 0 1 part k12 15 14 13 12 11 0 111 rp 11101 rd/rs 31 29 28 25 24 20 19 16 opcode k12 15 12 11 0 11100opccoh00001 rd 31 29 28 26 25 24 20 19 16 k16 15 0
104 32000d?04/2011 avr32 9.2.48 saturate 9.2.49 3 registers with k5 9.2.50 2 registers with k4 9.2.51 2 registers with cond4 9.2.52 4 registers with k2 9.2.53 3 registers with k8 and sa 9.2.54 k3 immediate 111 opcode 11011 rd 31 29 28 25 24 20 19 16 000000 s5 k5 15 12 11 10 9 5 4 0 111 rx 11110 ry 31 29 28 25 24 20 19 16 opcode k5 rd 15 9 8 4 3 0 100 rp 1 k4 rs 15 1312 987 43 0 111 rs 00000 rd 31 29 28 25 24 20 19 16 0001 opcode cond4 0000 15 12 11 8 7 4 3 0 111 rx 11110 ry 31 29 28 25 24 20 19 16 opcode x y ri 0 0 k2 rb 15 14 13 12 11 8 7 6 5 4 3 0 111 rx 11110 ry 31 29 28 25 24 20 19 16 opcode x y k8 rp 15 14 13 12 11 4 3 0 110101101 k3 0100 15 13 12 7 6 4 3 0
105 32000d?04/2011 avr32 9.2.55 address and b5 9.2.56 2 register operands 9.2.57 2 register operands and k3 9.2.58 2 register operands and k4 111 opcode 00001 b5[4:1] 31 29 28 25 24 20 19 16 b5[0] k15 15 14 0 11100 00000 rs 31 29 28 20 19 16 001000 1111opc rd 15 12 11 8 7 4 3 0 0 0 1 111 rs 000000 k3 31 29 28 25 24 19 18 16 001000 1111opc rd 15 12 11 8 7 4 3 0 1 111 rs 00000 k4 31 29 28 25 24 20 19 16 001000 1111opc rd 15 12 11 8 7 4 3 0 1
106 32000d?04/2011 avr32 9.3 instruction set summary 9.3.1 architecture revision unless otherwise noted, all instructions are part of revision 1 of the avr32 architecture. the fol- lowing instructions were added in revision 2, none were removed:  movh rd, imm  {add, sub, and, or, eor}{cond4}, rd, rx, ry  ld.{sb, ub, sh, uh, w}{cond4} rd, rp[disp]  st.{b, h, w}{cond4} rp[disp], rs  rsub{cond4} rd, imm 9.3.2 arithmetic operations table 9-2. arithmetic operations mnemonics operands / syntax description operation rev abs c rd absolute value. rd |rd| 1 acr c rd add carry to register. rd rd + c 1 adc e rd, rx, ry add with carry. rd rx + ry + c 1 add c rd, rs add. rd rd + rs 1 e rd, rx, ry << sa add shifted. rd rx + (ry< 107 32000d?04/2011 avr32 9.3.3 multiplication operations sub crd, rs subtract. rd rd - rs 1 e rd, rx, ry << sa rd rx - (ry< 108 32000d?04/2011 avr32 9.3.4 dsp operations table 9-4. dsp operations mnemonics operands / syntax description operation rev addhh.w e rd, rx:, ry: add signed halfwords. (32 16 +16) rd se(rx:) + se(ry:) 1 machh.d e rd, rx:, ry: multiply signed halfwords and accumulate. (48 16x16 + 48) rd+1:rd rx: * ry: + rd+1:rd 1 machh.w e rd, rx:, ry: multiply signed halfwords and accumulate. (32 16x16 + 32) rd rx: * ry: + rd 1 macwh.d e rd, rx, ry: multiply signed word and halfword and accumulate. (48 32x16 + 48) rd+1:rd ((rx * ry:) <<16) + rd+1:rd 1 mulhh.w e rd, rx:, ry: signed multiply of halfwords. (32 16 x 16) rd rx: * ry: 1 mulwh.d e rd, rx, ry: unsigned multiply, word and halfword. 48 (32 x 16) rd+1:rd ((rx * ry:) <<16) 1 mulnhh.w e rd, rx:, ry: signed multiply of halfwords. (32 16 x 16) rd rx: * (- ry:) 1 mulnwh.d e rd, rx, ry: signed multiply, word and negated halfword. 48 (32 x 16) rd+1:rd ((rx * (- ry:)) << 16) 1 satadd.h e rd, rx, ry saturated add halfwords. rd se(sat(rx[15:0] + ry[15:0])) 1 satadd.w e rd, rx, ry saturated add. rd sat(rx + ry) 1 satsub.h e rd, rx, ry saturated subtract halfwords. rd se(sat(rx[15:0] - ry[15:0])) 1 satsub.w e rd, rx, ry saturated subtract. rd sat(rx - ry) 1 e rd, rs, imm rd sat(rs - se(imm16) ) 1 satrnds e rd >> sa, bp signed saturate from bit given by sa5 after a right shift with rounding of bp5 bit positions. rd sat(round((rd >> sa5)), bp5) 1 satrndu e rd >> sa, bp unsigned saturate from bit given by sa5 after a right shift with rounding of bp5 bit positions. rd sat(round((rd >> sa5)), bp5) 1 sats e rd >> sa, bp signed saturate from bit given by sa5 after a right shift of bp5 bit positions. rd sat((rd >> sa5), bp5) 1 satu e rd >> sa, bp unsigned saturate from bit given by sa5 after a right shift of bp5 bit positions. rd sat((rd >> sa5),bp5) 1 subhh.w e rd, rx:, ry: subtract signed halfwords. (32 16 -16) rd se(rx:) - se(ry:) 1
109 32000d?04/2011 avr32 mulsathh.h e rd, rx:, ry: fractional signed multiply with saturation. return halfword. (16 16 x 16) rd se(sat(rx: *ry: << 1) >> 16) 1 mulsathh.w e rd, rx:, ry: fractional signed multiply with saturation. return word. (32 16 x 16) rd sat( rx:*ry: << 1 ) 1 mulsatrndhh.h e rd, rx:, ry: fractional signed multiply with rounding. return halfword. (16 16 x 16) rd se(( sat(rx: *ry: << 1) +0x8000 ) >> 16) 1 mulsatrndwh. w e rd, rx, ry: fractional signed multiply with rounding. return word. (32 32 x 16) rd se(( sat(rx*ry: << 1) +0x8000 ) >> 16) 1 mulsatwh.w e rd, rx, ry: fractional signed multiply with saturation. return word. (32 32 x 16) rd sat(rx*ry: << 1) >>16 1 macsathh.w e rd, rx:, ry: fractional signed multiply accumulate with saturation. return word. (32 16 x 16 + 32) rd sat (sat(rx: *ry: << 1) +rd) 1 table 9-4. dsp operations (continued)
110 32000d?04/2011 avr32 9.3.5 logic operations table 9-5. logic operations mnemonics operands / syntax description operation rev and crd, rs logical and. rd rd rs 1 e rd, rx, ry << sa rd rx (ry << sa5) 1 e rd, rx, ry >> sa rd rx (ry >> sa5) 1 and{cond4} e rd, rx, ry logical and if condition satisfied. if (cond4) rd rx ry 2 andn c rd, rs logical and not. rd rd ? rs 1 andh erd, imm logical and high halfword, low halfword is unchanged. rd[31:16] rd[31:16] imm16 1 e rd, imm, coh logical and high halfword, clear other halfword. rd[31:16] rd[31:16] imm16 rd[15:0] 0 1 andl erd, imm logical and low halfword, high halfword is unchanged. rd[15:0] rd[15:0] imm16 1 e rd, imm, coh logical and low halfword, clear other halfword. rd[15:0] rd[15:0] imm16 rd[31:16] 0 1 com c rd one?s complement (not). rd ? rd 1 eor crd, rs logical exclusive or. rd rd rs 1 e rd, rx, ry << sa rd rd (rs << sa5) 1 e rd, rx, ry >> sa rd rd (rs >> sa5) 1 eor{cond4} e rd, rx, ry logical eor if condition satisfied. if (cond4) rd rx ry 2 eorh e rd, imm logical exclusive or (high halfword). rd[31:16] rd[31:16] imm16 1 eorl e rd, imm logical exclusive or (low halfword). rd[15:0] rd[15:0] imm16 1 or crd, rs logical (inclusive) or. rd rd rs 1 e rd, rx, ry << sa rd rd (rs << sa5) 1 e rd, rx, ry >> sa rd rd (rs >> sa5) 1 or{cond4} e rd, rx, ry logical or if condition satisfied. if (cond4) rd rx ry 2 orh e rd, imm logical or (high halfword). rd[31:16] rd[31:16] imm16 1 orl e rd, imm logical or (low halfword). rd[15:0] rd[15:0] imm16 1 tst c rd, rs test register for zero. rd rs 1
111 32000d?04/2011 avr32 9.3.6 bit operations table 9-6. bit operations mnemonics operands / syntax description operation rev bfexts e rd, rs, o5, w5 extract and sign-extend the w5 bits in rs starting at bit-offset o5 to rd. see instruction set reference 1 bfextu e rd, rs, o5, w5 extract and zero-extend the w5 bits in rs starting at bit-offset o5 to rd. see instruction set reference 1 bfins e rd, rs, o5, w5 insert the lower w5 bits of rs in rd at bit- offset o5. see instruction set reference 1 bld e rd, bp bit load. c rd[bp5] z rd[bp5] 1 brev c rd bit reverse. rd[0:31] rd[31:0] 1 bst e rd, bp bit store. rd[bp5] c1 casts.b c rd typecast byte to signed word. rd se(rd[7:0]) 1 casts.h c rd typecast halfword to signed word. rd se(rd[15:0]) 1 castu.b c rd typecast byte to unsigned word. rd ze(rd[7:0]) 1 castu.h c rd typecast halfword to unsigned word. rd ze(rd[15:0]) 1 cbr c rd, bp clear bit in register. rd[bp5] 01 clz e rd, rs count leading zeros. see instruction set reference 1 sbr c rd, bp set bit in register. rd[bp5] 11 swap.b c rd swap bytes in register. rd[31:24] rd[7:0], rd[23:16] rd[15:8], rd[15:8] rd[23:16], rd[7:0] rd[31:24] 1 swap.bh c rd swap bytes in each halfword. rd[31:24] rd[23:16], rd[23:16] rd[31:24], rd[15:8] rd[7:0], rd[7:0] rd[15:8] 1 swap.h c rd swap halfwords in register. rd[31:16] rd[15:0], rd[15:0] rd[31:16] 1
112 32000d?04/2011 avr32 9.3.7 shift operations table 9-7. operations mnemonics operands / syntax description operation rev asr e rd, rx, ry arithmetic shift right (signed) . see instruction set reference 1 erd, rs, sa 1 crd, sa 1 lsl e rd, rx, ry logical shift left. see instruction set reference 1 erd, rs, sa 1 crd, sa 1 lsr e rd, rx, ry logical shift right. see instruction set reference 1 erd, rs, sa 1 crd, sa 1 rol c rd rotate left through carry. see instruction set reference 1 ror c rd rotate right th rough carry. see instruction set reference 1
113 32000d?04/2011 avr32 9.3.8 instruction flow table 9-8. instruction flow mnemonics operands / syntax description operation rev br{cond3} c disp branch if condition satisfied. if (cond3) pc pc + (se(disp8)<<1) 1 br{cond4} e disp if (cond4) pc pc + (se(disp21)<<1) 1 rjmp c disp relative jump. pc pc + (se(disp10)<<1) 1 acall c disp application call lr pc + 2 pc ?( acba + (ze(disp8)<<2)) 1 icall c rd register inderect call. lr pc + 2 pc rd 1 mcall e rp[disp] memory call. lr pc + 4 pc *((rp && 0xffff_fffc) + (se(disp16)<<2)) 1 rcall cdisp relative call. lr pc + 2 pc pc + (se(disp10)<<1) 1 edisp lr pc + 4 pc pc + (se(disp21)<<1) 1 scall c supervisor call see instruction set reference. 1 sscall c secure state call see in struction set reference. 1 ret{cond4} c rs conditional return from subroutine with move and test of return value. if (rs != {sp, pc}) r12 rs pc lr 1 conditional return from subroutine with return of false value. if (rs = lr) r12 -1 pc lr 1 conditional return from subroutine with return of false value. if (rs = sp) r12 0 pc lr 1 conditional return from subroutine with return of true value. if (rs = pc) r12 1 pc lr 1 retd c return from debug mode sr rsr_dbg pc lr_dbg 1 rete c return from event handler see instruction set reference. 1 rets c return from supervisor call see instruction set reference. 1 retss c return from secure state s ee instruction set reference. 1
114 32000d?04/2011 avr32 9.3.9 data transfer 9.3.9.1 move/load immediate operations 9.3.9.2 load/store operations table 9-9. move/load immediate operations mnemonics operands / syntax description operation rev mov crd, imm load immediate into register. rd se(imm8) 1 e rd, imm rd se(imm21) 1 c rd, rs copy register. rd rs 1 mov{cond4} e rd, rs copy register if condition is true if (cond4) rd rs 1 erd, imm load immediate into register if condition is true if (cond4) rd se(imm8) 1 movh e rd, imm load immediate into high halfword of register. rd imm16<<16 2 table 9-10. load/store operations mnemonics operands / syntax description operation rev ld.ub c rd, rp++ load unsigned byte with post-increment. rd ze(*(rp++)) 1 c rd, --rp load unsigned byte with pre-decrement. rd ze(*(--rp)) 1 c rd, rp[disp] load unsigned byte with displacement. rd ze(*(rp+ze(disp3))) 1 e rd, rp[disp] rd ze(*(rp+se(disp16))) 1 e rd, rb[ri< 115 32000d?04/2011 avr32 ld.sh crd, rp++ load signed halfword with post- increment. rd se(*(rp++)) 1 c rd, --rp load signed halfword with pre-decrement. rd se(*(--rp)) 1 c rd, rp[disp] load signed halfword with displacement. rd se(*(rp+(ze(disp3)<<1))) 1 e rd, rp[disp] rd se(*(rp+(se(disp16)))) 1 e rd, rb[ri< << 2] load word with extracted index into rd. rd *(rb+(ri: << 2)) 1 ld.w{cond4} e rd, rp[disp] load word with displacement if condition satisfied. if {cond4} rd *(rp+ze(disp9<<2)) 2 ld.d c rd, rp++ load doubleword with post-increment. rd+1:rd (*(rp++)) 1 c rd, --rp load doubleword with pre-decrement. rd+1:rd (*(--rp)) 1 c rd, rp load doubleword. rd+1:rd *(rp) 1 e rd, rp[disp] load double with displacement. rd+1:rd *(rp+se(disp16)) 1 e rd, rb[ri<, rp[disp] load byte with displacement and insert at specified byte location in rd. rd: *(rp+(se(disp12))) 1 ldins.h e rd:, rp[disp] load halfword with displacement and insert at specified halfword location in rd. rd: *(rp+(se(disp12)<<1)) 1 ldswp.sh e rd, rp[disp] load halfword with displacement, swap bytes and sign-extend te m p *(rp+(se(disp12) << 1) rd se(temp[7:0], temp[15:8]) 1 ldswp.uh e load halfword with displacement, swap bytes and zero-extend te m p *(rp+(se(disp12) << 1) rd ze(temp[7:0], temp[15:8]) 1 ldswp.w e load word with displacement and swap bytes. te m p *(rp+(se(disp12) << 2) rd[31:24] temp[7:0], rd[23:16] temp[15:8], rd[15:8] temp[23:16], rd[7:0] temp[31:24] 1 lddpc c rd, pc[disp] load with displacement from pc. rd *((pc && 0xffff_fffc) +(ze(disp7)<<2)) 1 lddsp c rd, sp[disp] load with displacement from sp. rd *((sp && 0xffff_fffc) +(ze(disp7)<<2)) 1 table 9-10. load/store operations (continued)
116 32000d?04/2011 avr32 st.b c rp++, rs store with post-increment. *(rp++) rs[7:0] 1 c --rp, rs store with pre-decrement. *(--rp) rs[7:0] 1 c rp[disp], rs store byte with displacement. *(rp+ze(disp3)) rs[7:0] 1 e rp[disp], rs *(rp+se(disp16)) rs[7:0] 1 e rb[ri<, ry: combine halfwords to word and store with displacement. *(rp+(ze(disp8)<<2)) {rx:, ry:} 1 e rb[ri<, ry: combine halfwords to word and store indexed. *(rb+(ri << sa2)) {rx:, ry:} 1 table 9-10. load/store operations (continued)
117 32000d?04/2011 avr32 9.3.9.3 multiple data 9.3.10 system/control stswp.h e rp[disp], rs swap bytes and store halfword with displacement. te m p rs[7:0], rs[15:8] *(rp+(se(disp12) << 1) te m p 1 stswp.w e swap bytes and store word with displacement. temp[31:24] rs[7:0], temp[23:16] rs[15:8], temp[15:8] rs[23:16], temp[7:0] rs[31:24] *(rp+(se(disp12) << 2) te m p 1 xchg e rd, rx, ry exchange register and memory see instruction set reference 1 table 9-10. load/store operations (continued) table 9-11. mutiple data mnemonics operands / syntax description operation rev ldm e rp{++}, reglist16 {, r12={-1,0,1}} load multiple registers. r12 is tested if pc is loaded. see instruction set reference 1 ldmts e rp{++}, reglist16 load multiple registers in application context for task switch. see instruction set reference 1 popm c reglist8 {, r12={- 1,0,1}} pop multiple registers from stack. r12 is tested if pc is popped. see instruction set reference 1 pushm c reglist8 push multiple registers to stack. see instruct ion set reference 1 stm e {--}rp, reglist16 store multiple r egisters. see instruction set reference 1 stmts e {--}rp, reglist16 store multiple registers in application context for task switch. see instruction set reference 1 table 9-12. system/control mnemonics operands / syntax description operation rev breakpoint c breakpoint. see instruction set reference 1 cache e rp[disp], op perform cache oper ation see instruction set reference 1 csrf c bp clear status register flag. sr[bp5] 01 csrfcz c bp copy status register flag to c and z. c sr[bp5] z sr[bp5] 1 frs c frs invalidates the return addre ss stack see instruction set reference 1 mfdr e rd, debugregaddress move debug register to rd. rd debugregister[debugregaddr] 1 mfsr e rd, sysregno move system register to rd. rd systemregister[sysregno] 1 mtdr e debugregaddress, rs move rs to debug register. debugregister[debugregaddr] rs 1 mtsr e sysregno, rs move rs to system register. systemre gister[sysregno] rs 1 musfr c rs move rs to status register sr[3:0] rs[3:0] 1 mustr c rd move status register to rd rd ze(sr[3:0]) 1
118 32000d?04/2011 avr32 nop c no operation see instruction set reference 1 pref e rp[disp] prefetch cache line see instruction set reference 1 sleep e op8 enter sleep mode. see instruction set reference 1 sr{cond4} c rd conditionally set register to true or false. if (cond4) rd 1; else rd 0; 1 ssrf c bp set status register flag. sr[bp5] 11 sync e op8 flush write buffer see instruction set reference 1 tlbr c read tlb entry see instruction set reference 1 tlbs c search tlb for entry see instruction set reference 1 tlbw c write tlb entry see instruction set reference 1 table 9-12. system/control (continued)
119 32000d?04/2011 avr32 9.3.11 coprocessor interface table 9-13. coprocessor interface mnemonics operands / syntax description operation rev cop e cp#, crd, crx, cry, op coprocessor operation. crd crx op cry 1 ldc.d e cp#, crd, rp[disp] load coprocessor register crd+1:crd *(rp+ze(disp8<<2)) 1 e cp#, crd, --rp load coprocessor register with pre- decrement crd+1:crd *(--rp) 1 e cp#, crd, rb[ri< 120 32000d?04/2011 avr32 9.3.12 instructions to aid java execution 9.3.13 simd operations stcm.d e cp#, {--}rp, reglistcpd8 store multiple coprocessor double registers see instruction set reference 1 stcm.w e cp#, {--}rp, reglistcph8 store multiple coprocessor high registers see instruction set reference 1 stcm.w e cp#, {--}rp, reglistcpl8 store multiple coprocessor low regi sters see instruction set reference 1 table 9-13. coprocessor interface (continued) table 9-14. instructions to aid ja va (card) execution mnemonics operands / syntax description operation rev incjosp c imm increment java stack pointer josp + {-4, -3, -2, -1, 1, 2, 3, 4} 1 popjc c pop java context from fr ame see instruction set reference 1 pushjc c push java context to frame see instruction set reference 1 retj c return from java trap see instruction set reference 1 table 9-15. simd operations mnemonics operands / syntax description operation rev pabs.{sb/sh} e rd, rs packed absolute value see instruction set reference 1 packsh.{ub/sb} e rd, rx, ry pack halfwords to bytes see instruction set reference 1 packw.sh e rd, rx, ry pack words to halfwords see instruction set reference 1 padd.{b/h} e rd, rx, ry packed addition see instruction set reference 1 paddh.{ub/sh} e rd, rx, ry packed addition with halving see instruction set reference 1 padds.{ub/sb/uh/sh} e rd, rx, ry packed addition with saturation see instruction set reference 1 paddsub.h e rd, rx:, ry: packed halfword addition and subtraction see instruction set reference 1 paddsubh.sh e rd, rx:, ry: packed halfword addition and subtraction with halving see instruction set reference 1 paddsubs.{uh/sh} e rd, rx:, ry: packed halfword addition and subtraction with saturation see instruction set reference 1 paddx.h e rd, rx, ry packed halfword addition with crossed operand see instruction set reference 1 paddxh.sh e rd, rx, ry packed halfword addition with crossed operand and halving see instruction set reference 1 paddxs.{uh/sh} e rd, rx, ry packed halfword addition with crossed operand and saturation see instruction set reference 1 pasr.{b/h} e rd, rs, {sa} packed arithmetic shift left see instruction set reference 1 pavg.{ub/sh} e rd, rx, ry packed average see instruction set reference 1 plsl.{b/h} e rd, rs, {sa} packed logic shift left see instruction set reference 1
121 32000d?04/2011 avr32 9.3.14 memory read-modify-write instructions plsr.{b/h} e rd, rs, {sa} packed logic shift right see instruction set reference 1 pmax.{ub/sh} e rd, rx, ry packed maximum value see instruction set reference 1 pmin.{ub/sh} e rd, rx, ry packed minimum value see instruction set reference 1 psad e rd, rx, ry sum of absolute diffe rences see instruction set reference 1 psub.{b/h} e rd, rx, ry packed subtra ction see instruction set reference 1 psubadd.h e rd, rx:, ry: packed halfword subtraction and addition see instruction set reference 1 psubaddh.sh e rd, rx:, ry: packed halfword subtraction and addition with halving see instruction set reference 1 psubadds.{uh/sh} e rd, rx:, ry: packed halfword subtraction and addition with saturation see instruction set reference 1 psubh.{ub/sh} e rd, rx, ry packed subtraction with halving see instruction set reference 1 psubs.{ub/sb/uh/sh} e rd, rx, ry packed subtracti on with saturation see instruction set reference 1 psubx.h e rd, rx, ry packed halfword subtraction with crossed operand see instruction set reference 1 psubxh.sh e rd, rx, ry packed halfword subtraction with crossed operand and halving see instruction set reference 1 psubxs.{uh/sh} e rd, rx, ry packed halfword subtraction with crossed operand and saturation see instruction set reference 1 punpck{ub/sb}.h e rd, rs: unpack bytes to halfwords see instruction set reference 1 table 9-15. simd operations (continued) table 9-16. memory read-modify-write instructions mnemonics operands / syntax description operation rev memc e imm, bp clear bit in memo ry memory[(imm15< <2)[bp5]] = 0 1 mems e imm, bp set bit in memory memory[(imm15< <2)[bp5]] = 1 1 memt e imm, bp toggle bit in memory memory[(imm15< <2)[bp5]] = ? memory[(imm15<<2)[bp5]] 1
122 32000d?04/2011 avr32 9.4 base instructi on set description the following chapter describ es the instructions in the base instruction set.
123 32000d?04/2011 avr32 abs ? absolute value architecture revision: architecture revision1 and higher. description the absolute value of the contents to the register specified is written back to the register. if the initial value equals the maximum negative value (0x80000000), the result will equal the initial value. operation: i. rd |rd|; syntax: i. abs rd operands: i. d {0, 1, ?, 15} status flags: q: not affected v: not affected n: not affected z: (res[31:0] == 0) c: not affected opcode: 010111000100 rd 15 13 12 9 8 4 3 0
124 32000d?04/2011 avr32 acall ? application call architecture revision: architecture revision1 and higher. description the acall instruction performs an application function call. operation: i. lr pc + 2; pc *(acba + (ze(disp8)<<2)); syntax: i. acall disp operands: i. disp {0, 4, ..., 1020} status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: note: acba must be word aligned. failing to align acba correctly may lead to erronous be- havior. 1101 disp8/label 0000 15 12 11 4 3 1 0
125 32000d?04/2011 avr32 acr ? add carry to register architecture revision: architecture revision1 and higher. description adds carry to the specified destination register. operation: i. rd rd + c; syntax: i. acr rd operands: i. d {0, 1, ?, 15} status flags q: not affected v: v res[31] ? rd[31] n: n res[31] z: z (res[31:0] == 0) z c: c ? res[31] rd[31] opcode: example: ; add a 32-bit variable (r0) to a 64-bit variable (r2:r1) add r1, r0 acr r2 010111000000 rd 15 13 12 9 8 4 3 0
126 32000d?04/2011 avr32 adc ? add with carry architecture revision: architecture revision1 and higher. description adds carry and the two registers specified and stores the result in destination register. operation: i. rd rx + ry + c; syntax: i. adc rd, rx, ry operands: i. {d, x, y} {0, 1, ?, 15} status flags: q: not affected v: v (rx[31] ry[31] ? res[31]) ( ? rx[31] ? ry[31] res[31]) n: n res[31] z: z (res[31:0] == 0) z c: c rx[31] ry[31] rx[31] ? res[31] ry[31] ? res[31] opcode: example ; add two 64-bit variables r1:r0 and r3:r2 and store the result in r1:r0 add r0, r2 adc r1, r1, r3 111 rx 00000 ry 31 29 28 25 24 20 19 16 000000000100 rd 15 12 11 4 3 0
127 32000d?04/2011 avr32 add? add without carry architecture revision: architecture revision1 and higher. description adds the two registers specified and stores the result in destination register. format ii allows shifting of the second operand. operation: i. rd rd + rs; ii. rd rx + (ry<< sa2); syntax: i. add rd, rs ii. add rd, rx, ry << sa operands: i. {d, s} {0, 1, ?, 15} ii. {d, x, y} {0, 1, ?, 15} sa {0, 1, 2, 3} status flags format i: op1 = rd, op2 = rs format ii:op1 = rx, op2 = ry << sa2 q: not affected v: v (op1[31] op2[31] ? res[31]) ( ? op1[31] ? op2[31] res[31]) n: n res[31] z: z (res[31:0] == 0) c: c op1[31] op2[31] op1[31] ? res[31] op2[31] ? res[31] opcode: format i: format ii: 000 rs 00000 rd 15 13 12 9 8 4 3 0 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000000000 shift amount rd 15 12 11 8 7 6 5 4 3 0
128 32000d?04/2011 avr32 add{cond4} ? conditional add architecture revision: architecture revision 2 and higher. description performs an addition and stores the result in destination register. operation: i. if ( cond4) rd rx + ry; syntax: i. add{cond4}rd, rx, ry operands: i. {d, x, y} {0, 1, ?, 15} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 11101 ry 31 29 28 25 24 20 19 16 1110 cond4 0000 rd 15 12 11 8 7 0 rx
129 32000d?04/2011 avr32 addabs? add absolute value architecture revision: architecture revision1 and higher. description adds rx and the absolute value of ry and stores the result in destination register. useful for cal- culating the sum of absolute differences. operation: i. rd rx + |ry|; syntax: i. addabs rd, rx, ry operands: i. {d, x, y} {0, 1, ?, 15} status flags q: not affected v: not affected n: not affected z: z (res[31:0] == 0) c: not affected opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000011100100 rd 15 12 11 4 3 0
130 32000d?04/2011 avr32 addhh.w? add halfwords into word architecture revision: architecture revision1 and higher. description adds the two halfword registers specified and stores the result in the destination word-register. the halfword registers are selected as either the high or low part of the operand registers. operation: i. if (rx-part == t) then operand1 = se(rx[31:16]) else operand1 = se(rx[15:0]); if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); rd operand1 + operand2; syntax: i. addhh.wrd, rx:, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: op1 = operand1, op2 = operand2 q: not affected v: v (op1[31] op2[31] ? res[31]) ( ? op1[31] ? op2[31] res[31]) n: n res[31] z: z (res[31:0] == 0) c: c op1[31] op2[31] op1[31] ? res[31] op2[31] ? res[31] opcode: example: addhh.wr10, r2:t, r3:b will perform r10 se(r2[31:16]) + se(r3[15:0]) 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000111000xy rd 15 12 11 8 7 6 5 4 3 0
131 32000d?04/2011 avr32 and ? logical and with optional logical shift architecture revision: architecture revision1 and higher. description performs a bitwise logical and between the specified registers and stores the result in the desti- nation register. operation: i. rd rd rs; ii. rd rx (ry << sa5); iii. rd rx (ry >> sa5); syntax: i. and rd, rs ii. and rd, rx, ry << sa iii. and rd, rx, ry >> sa operands: i. {d, s} {0, 1, ?, 15} ii, iii {d, x, y} {0, 1, ?, 15} sa {0, 1, ?, 31} status flags q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: not affected opcode format i: format ii: 000 rs 00110 rd 15 13 12 9 8 4 3 0 111 rx 11110 ry 31 29 28 25 24 20 19 16 0000000 sa5 rd 15 9 8 4 3 0
132 32000d?04/2011 avr32 format iii: 111 rx 11110 ry 31 29 28 25 24 20 19 16 0000001 sa5 rd 15 9 8 4 3 0
133 32000d?04/2011 avr32 and{cond4} ? conditional and architecture revision: architecture revision1 and higher. architecture revision: architecture revision 2 and higher. description performs a bitwise logical and between the specified registers and stores the result in the desti- nation register. operation: i. if ( cond4) rd rx ry; syntax: i. and{cond4}rd, rx, ry operands: i. {d, x, y} {0, 1, ?, 15} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 11101 ry 31 29 28 25 24 20 19 16 1110 cond4 0010 rd 15 12 11 8 7 0 rx
134 32000d?04/2011 avr32 andh, andl ? logi cal and into high or low half of register architecture revision: architecture revision1 and higher. description performs a bitwise logical and between the high or the low halfword in the specified register and a constant. the result is stored in the high or the low halfword of the destination register while the other bits remain unchanged. the clear other half (coh) parameter allows the other half to be cleared. operation: i. rd[31:16] rd[31:16] imm16; ii. rd[31:16] rd[31:16] imm16; rd[15:0] 0; iii. rd[15:0] rd[15:0] imm16; iv. rd[15:0] rd[15:0] imm16; rd[31:16] 0; syntax: i. andh rd, imm ii. andh rd, imm, coh iii. andl rd, imm iv. andl rd, imm, coh operands: i, ii, iii, iv. d {0, 1, ?, 15} imm {0, 1, ..., 65535} status flags: q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: not affected opcode format i, ii: 111001coh00001 rd 31 29 28 26 25 24 20 19 16 imm16 15 0
135 32000d?04/2011 avr32 format iii, iv: 111000coh00001 rd 31 29 28 26 25 24 20 19 16 imm16 15 0
136 32000d?04/2011 avr32 andn ? logical and not architecture revision: architecture revision1 and higher. description performs a bitwise logical andnot between the spec ified registers and stor es the result in the destination register. operation: i. rd rd ? rs; syntax: i. andn rd, rs operands: i. {d, s} {0, 1, ?, 15} status flags q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: not affected opcode(s): 000 rs 01000 rd 15 13 12 9 8 4 3 0
137 32000d?04/2011 avr32 asr ? arithmetic shift right architecture revision: architecture revision1 and higher. description shifts all bits in a register to the right the amount of bits specified by the five least significant bits in ry or an immediate while keeping the sign. operation: i. rd asr(rx, ry[4:0]); ii. rd asr(rd, sa5); iii. rd asr(rs, sa5); syntax: i. asr rd, rx, ry ii. asr rd, sa iii. asr rd, rs, sa operands: i. d, x, y {0, 1, ?, 15} ii. d {0, 1, ?, 15} sa {0, 1, ?, 31} iii. {d,s} {0, 1, ?, 15} sa {0, 1, ?, 31} status flags: format i: shamt = ry[4:0], op = rx format ii: shamt = sa5, op = rd format iii: shamt = sa5, op = rs q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: if (shamt != 0) then c op[shamt-1] else c 0 opcode
138 32000d?04/2011 avr32 format i: format ii: format iii: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000010000100 rd 15 12 11 4 3 0 101 bit[4:1] 1010bit[0] rd 15 1312 98 543 0 111 rs 00000 rd 31 29 28 25 24 20 19 16 00010100000 sa5 15 12 11 8 7 5 4 0
139 32000d?04/2011 avr32 bfexts ? bitfield ex tract and sign-extend architecture revision: architecture revision1 and higher. description this instruction extracts and sign-extends the w5 bits in rs starting at bit-offset bp5 to rd. operation: i. rd se(rs[bp5+w5-1:bp5]); syntax: i. bfexts rd, rs, bp5, w5 operands: i. {d, s} {0, 1, ?, 15} {bp5, w5} {0, 1, ..., 31} status flags: q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: c res[31] opcode: format i: note: if (w5 = 0) or if (bp5 + w5 > 32) the result is undefined. 111 rd 11101 rs 31 29 28 25 24 20 19 16 101100 bp5 w5 15 12 11 10 9 5 4 0
140 32000d?04/2011 avr32 bfextu ? bitfield ex tract and zero-extend architecture revision: architecture revision1 and higher. description this instruction extracts and zero-extends the w5 bits in rs starting at bit-offset bp5 to rd. operation: i. rd ze(rs[bp5+w5-1:bp5]); syntax: i. bfextu rd, rs, bp5, w5 operands: i. {d, s} {0, 1, ?, 15} {bp5, w5} {0, 1, ..., 31} status flags: q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: c res[31] opcode: format i: note: if (w5 = 0) or if (bp5 + w5 > 32) the result is undefined. 111 rd 11101 rs 31 29 28 25 24 20 19 16 110000 bp5 w5 15 12 11 10 9 5 4 0
141 32000d?04/2011 avr32 bfins ? bitfield insert architecture revision: architecture revision1 and higher. description this instruction inserts the lower w5 bi ts of rs in rd at bit-offset bp5. operation: i. rd[bp5+w5-1:bp5] rs[w5-1:0]; syntax: i. bfins rd, rs, bp5, w5 operands: i. {d, s} {0, 1, ?, 15} {bp5, w5} {0, 1, ..., 31} status flags: q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: c res[31] opcode: format i: note: if (w5 = 0) or if (bp5 + w5 > 32) the result is undefined. 111 rd 11101 rs 31 29 28 25 24 20 19 16 110100 bp5 w5 15 12 11 10 9 5 4 0
142 32000d?04/2011 avr32 bld ? bit load from r egister to c and z architecture revision: architecture revision1 and higher. description copy an arbitrary bit in a register to c and z. operation: i. c rd[bp5]; z rd[bp5]; syntax: i. bld rd, bp operands: i. d {0, 1, ?, 15} bp {0, 1, ?, 31} status flags q: not affected. v: not affected. n: not affected. z: z rd[bp5 ] c: c rd[bp5] opcode: 111011011011 rd 31 29 28 25 24 20 19 16 00000000000 bit position 15 5 4 0
143 32000d?04/2011 avr32 br{cond} ? branch if condition satisfied architecture revision: architecture revision1 and higher. description branch if the specified condition is satisfied. operation: i. if (cond3) pc pc + (se(disp8) << 1); else pc pc + 2; ii. if (cond4) pc pc + (se(disp21) << 1); else pc pc + 4; syntax: i. br{cond3}disp ii. br{cond4}disp operands: i. cond3 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl} disp {-256, -254, ..., 254} ii. cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} disp {-2097152, -2097150, ..., 2097150} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 1100 disp8 0 cond3 15 13 12 11 4 3 2 0
144 32000d?04/2011 avr32 format ii: 111 disp21[20:1 0100 d21 cond4 31 29 28 25 24 20 19 16 disp21[15:0] 15 0 [16]
145 32000d?04/2011 avr32 breakpoint ? software debug breakpoint architecture revision: architecture revision1 and higher. description if the on chip debug system is enabled, this instruction traps a software breakpoint for debugging. the breakpoint instruc- tion will enter debug mode disabling all inte rrupts and exceptions. if the on chip debug system is not enabled, this instruction will execute as a nop . operation: i. if (sr[dm]==0) rsr_dbg sr; rar_dbg address of first non-completed instruction; sr[r] 1; sr[j] 1; sr[d] 1; sr[m2:m0] b?110; sr[dm] 1; sr[em] 1; sr[gm] 1; pc evba+0x1c; else pc pc + 2; syntax: i. breakpoint operands: none status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: note: if no on chip debug system is implemented, this instru ction will execute as a "nop". 1101011001110011 15 98 43 0
146 32000d?04/2011 avr32 brev ? bit reverse architecture revision: architecture revision1 and higher. description bit-reverse the contents in the register. operation: i. rd[31:0] rd[0:31]; syntax: i. brev rd operands: i. d {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: z (res[31:0] == 0) c: not affected. opcode: 010111001001 rd 15 13 12 9 8 4 3 0
147 32000d?04/2011 avr32 bst ? copy c to register bit architecture revision: architecture revision1 and higher. description copy the c-flag to an arbitrary bit in a register. operation: i. rd[bp5] c; syntax: i. bst rd, bp operands: i. d {0, 1, ?, 15} bp {0, 1, ?, 31} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 1110 1111011 rd 31 29 28 25 24 20 19 16 00000000000 bit position 15 5 4 0 1
148 32000d?04/2011 avr32 cache ? perform cac he control operation architecture revision: architecture revision1 and higher. description control cache operation. operation: i. issue a command to the cache syntax: i. cache rp[disp], op5 operands: i. disp {-1024, -1023, ..., 1023} p {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. op[4:3] semantic 00 instruction cache 01 data cache or unified cache 10 secondary cache 11 tertiary cache op[2:0] semantic 000 implementation definedk 001 implementation defined 010 implementation defined 011 implementation defined 100 implementation defined 101 implementation defined 110 implementation defined 111 implementation defined
149 32000d?04/2011 avr32 opcode: note: this instruction can only be executed in a privilege d mode. execution from any other mode will trig ger a privilege violation exception. 1111 1000001 rp 31 20 19 16 op5 disp11 15 0 0
150 32000d?04/2011 avr32 casts.{h,b} ? typecast to signed word architecture revision: architecture revision1 and higher. description sign extends the halfword or byte that is specifi ed to word size. the result is stored back to the specified register. operation: i. rd[31:16] rd[15]; ii. rd[31:8] rd[7]; syntax: i. casts.h rd ii. casts.b rd operands: i, ii. d {0, 1, ?, 15} status flags : q: not affected. v: not affected. n: n res[31] z: z (res[31:0] == 0) c: c res[31] opcode: format i: format ii: 010111001000 rd 15 13 12 9 8 4 3 0 010111000110 rd 15 13 12 9 8 4 3 0
151 32000d?04/2011 avr32 castu.{h,b} ? type cast to unsigned word architecture revision: architecture revision1 and higher. description zero extends the halfword or byte that is specified to word size. the result is stored back to the specified register. operation: i. rd[31:16] 0; ii. rd[31:8] 0: syntax: i. castu.h rd ii. castu.b rd operands: i, ii. d {0, 1, ?, 15} status flags : q: not affected. v: not affected. n: n res[31] z: z (res[31:0] == 0) c: c res[31] opcode: format i: format ii: 010111000111 rd 15 13 12 9 8 4 3 0 010111000101 rd 15 13 12 9 8 4 3 0
152 32000d?04/2011 avr32 cbr ? clear bi t in register architecture revision: architecture revision1 and higher. description clears a bit in the specified register. all other bits are unaffected. operation: i. rd[bp5] 0; syntax: i. cbr rd, bp operands: i. d {0, 1, ?, 15} bp {0, 1, ?, 31} status flags: q: not affected v: not affected n: not affected z: z (res[31:0] == 0) c: not affected opcode: 101 bit[4:1] 1110bit[0] rd 15 1312 98 543 0
153 32000d?04/2011 avr32 clz ? count leading zeros architecture revision: architecture revision1 and higher. description counts the number of binary zero bits before the first binary one bit in a register value. the value returned from the operation can be used for doing normalize operations. if the operand is zero, the value 32 is returned. operation: i. temp 32; for (i = 31; i >= 0; i--) if (rs[i] == 1) then temp 31 - i; break; rd temp; syntax: i. clz rd, rs operands: i. {d, s} {0, 1, ?, 15} status flags q: not affected v: not affected n: not affected z: z (res[31:0] == 0) c: c (res[31:0] == 32) opcode: 111 rs 00000 rd 31 29 28 25 24 20 19 16 0001001000000000 15 12 11 8 7 0
154 32000d?04/2011 avr32 com ? one?s compliment architecture revision: architecture revision1 and higher. description perform a one?s complement of specified register. operation: i. rd ? rd; syntax: i. com rd operands: i. d {0, 1, ?, 15} status flags: q: not affected v: not affected n: not affected z: z (res[31:0] == 0) c: not affected opcode: 010111001101 rd 15 13 12 9 8 4 3 0
155 32000d?04/2011 avr32 cop ? coprocessor operation architecture revision: architecture revision1 and higher. description addresses a coprocessor and performs the specified operation on the specified registers. operation: i. cp#(crd) cp#(crx) op cp#(cry); syntax: i. cop cp#, crd, crx, cry, op operands: i. # {0, 1, ?, 7} op {0, 1, ?, 127} {d, x, y} {0, 1, ?, 15} status flags: q: coprocessor-specific v: coprocessor-specific n: coprocessor-specific z: coprocessor-specific c: coprocessor-specific opcode: example: cop cp2, cr0, cr1, cr2, 0 11100 op[6:5]11010 op[4:1] 31 29 28 25 24 20 19 16 cp# op[0] crd crx cry 15 0
156 32000d?04/2011 avr32 cp.b ? compare byte architecture revision: architecture revision1 and higher. description performs a compare between the lowermost bytes in the two operands specified. the operation is implemented by doing a subtraction without writeback of the difference. the operation sets the status flags according to the result of the subtraction, but does not affect the operand registers. operation: i. rd[7:0] - rs[7:0]; syntax: i. cp.b rd, rs operands: i. {d, s} {0, 1, ?, 15} status flags: q: not affected v: v (rd[7] ? rs[7] ? res[7]) ( ? rd[7] rs[7] res[7]) n: n res[7] z: z (res[7:0] == 0) c: c ? rd[7] rs[7] rs[7] res[7] ? rd[7] res[7] opcode 111 rs 00000 rd 31 29 28 25 24 20 19 16 0001100000000000 15 12 11 8 7 0
157 32000d?04/2011 avr32 cp.h ? compare halfword architecture revision: architecture revision1 and higher. description performs a compare between the lowermost halfwords in the two operands specified. the oper- ation is implemented by doing a subtraction without writeback of the difference. the operation sets the status flags according to the result of the subtraction, but does not affect the operand registers. operation: i. rd[15:0] - rs[15:0]; syntax: i. cp.h rd, rs operands: i. {d, s} {0, 1, ?, 15} status flags: format i: op1 = rd, op2 = rs q: not affected v: v (op1[15] ? op2[15] ? res[15]) ( ? op1[15] op2[15] res[15]) n: n res[15] z: z (res[15:0] == 0) c: c ? op1[15] op2[15] op2[15] res[15] ? op1[15] res[15] opcode 111 rs 00000 rd 31 29 28 25 24 20 19 16 0001100100000000 15 12 11 8 7 0
158 32000d?04/2011 avr32 cp.w ? compare word architecture revision: architecture revision1 and higher. description performs a compare between the two operands specified. the operation is implemented by doing a subtraction without writeback of the di fference. the operation sets the status flags according to the result of the subtraction, but does not affect the operand registers. operation: i. rd - rs; ii. rd - se(imm6); iii. rd - se(imm21); syntax: i. cp.w rd, rs ii. cp.w rd, imm iii. cp.w rd, imm operands: i. {d, s} {0, 1, ?, 15} ii. d {0, 1, ?, 15} imm {-32, -31, ..., 31} iii. d {0, 1, ?, 15} imm {-1048576, -104875, ..., 1048575} status flags: format i: op1 = rd, op2 = rs format ii: op1 = rd, op2 = se(imm6) format iii:op1 = rd, op2 = se(imm21) q: not affected v: v (op1[31] ? op2[31] ? res[31]) ( ? op1[31] op2[31] res[31]) n: n res[31] z: z (res[31:0] == 0) c: c ? op1[31] op2[31] op2[31] res[31] ? op1[31] res[31] opcode format i: format ii: 000 rs 00011 rd 15 13 12 9 8 4 3 0 010110 imm6 rd 15 13 12 10 9 4 3 0
159 32000d?04/2011 avr32 format iii: 111 imm21[20:17 0010 i21 rd 31 29 28 25 24 20 19 16 imm21[15:0 15 0 [16]
160 32000d?04/2011 avr32 cpc ? compare with carry architecture revision: architecture revision1 and higher. description performs a compare between the two registers specified. the operation is executed by doing a subtraction with carry (as borrow) without writeback of the difference. the operation sets the sta- tus flags according to the result of the subtraction, but does not affect the operand registers. note that the zero flag status before the operation is included in the calculation of the new zero flag. this instruction allows large compares (64, 128 or more bits). operation: i. rd - rs - c; ii. rd - c; syntax: i. cpc rd, rs ii. cpc rd operands: i. {d, s} {0, 1, ?, 15} ii. d {0, 1, ?, 15} status flags: in format ii, rs referred to below equals zero. q: not affected v: v (rd[31] ? rs[31] ? res[31]) ( ? rd[31] rs[31] res[31]) n: n res[31] z: z (res[31:0] == 0) z c: c ? rd[31] rs[31] rs[31] res[31] ? rd[31] res[31] opcode: format i: format ii: 111 rs 00000 rd 31 29 28 25 24 20 19 16 0001001100000000 15 12 11 8 7 0 010111000010 rd 15 13 12 9 8 4 3 0
161 32000d?04/2011 avr32 csrf ? clear stat us register flag architecture revision: architecture revision1 and higher. description clears the status register (sr) flag specified. operation: i. sr[bp5] 0; syntax: i. csrf bp operands: i. bp {0, 1, ?, 31} status flags: sr[bp5] 0, all other flags unchanged. opcode: note: privileged if bp5 > 15, ie. upper half of status r egister. an exception will be triggered if the upper half of the status register is attempted changed in user mode. 1101010 bp5 0011 15 11 10 9 8 4 3 0
162 32000d?04/2011 avr32 csrfcz ? copy status r egister flag to c and z architecture revision: architecture revision1 and higher. description copies the status register (sr) flag specified to c and z. operation: i. c sr[bp5]; z sr[bp5]; syntax: i. csrfcz bp operands: i. bp {0, 1, ?, 31} status flags: q: not affected v: not affected n: not affected z: z sr[bp5] c: c sr[bp5] opcode: note: privileged if bp5 > 15, ie. upper half of status re gister. a privilege violation exception will be trig- gered if the upper half of the status register is attempted read in user mode. 1101000 bp5 0011 15 11 10 9 8 4 3 0
163 32000d?04/2011 avr32 divs ? signed divide architecture revision: architecture revision1 and higher. description performs a signed divide between the two 32-bit register specified. the quotient is returned in rd, the remainder in rd+1. no exce ptions are taken if dividing by 0. result in rd and rd+1 is undefined when dividing by 0. the sign of the remainder will be the sa me as the dividend, and the quotient will be ne gative if the signs of rx and ry are opposite. operation: i. rd rx / ry; rd+1 rx % ry; syntax: i. divs rd, rx, ry operands: i. d {0, 2, ?, 14} {x, y} {0, 1, ?, 15} status flags q: not affected v: not affected n: not affected z: not affected c: not affected opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000011000000 rd 15 12 11 4 3 0
164 32000d?04/2011 avr32 divu ? unsi gned divide architecture revision: architecture revision1 and higher. description performs an unsigned divide between the two 32-bit register specified. the quotient is returned in rd, the remainder in rd+1. no ex ceptions are taken if dividing by 0. result in rd and rd+1 is undefined when dividing by 0. operation: i. rd rx / ry; rd+1 rx % ry; syntax: i. divu rd, rx, ry operands: i. d {0, 2, ?, 14} {x, y} {0, 1, ?, 15} status flags q: not affected v: not affected n: not affected z: not affected c: not affected opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000011010000 rd 15 12 11 4 3 0
165 32000d?04/2011 avr32 eor ? logical exclusive or wi th optional logical shift architecture revision: architecture revision1 and higher. description performs a bitwise logical exclusive-or between th e specified registers and stores the result in the destination register. operation: i. rd rd rs; ii. rd rx (ry << sa5); iii. rd rx (ry >> sa5); syntax: i. eor rd, rs ii. eor rd, rx, ry << sa iii. eor rd, rx, ry >> sa operands: i. {d, s} {0, 1, ?, 15} ii, iii. {d, x, y} {0, 1, ?, 15} sa {0, 1, ?, 31} status flags q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: not affected opcode: format i: format ii: 000 rs 00101 rd 15 13 12 9 8 4 3 0 111 rx 11110 ry 31 29 28 25 24 20 19 16 0010000 sa5 rd 15 9 8 4 3 0
166 32000d?04/2011 avr32 format iii: 111 rx 11110 ry 31 29 28 25 24 20 19 16 0010001 sa5 rd 15 9 8 4 3 0
167 32000d?04/2011 avr32 eor{cond4} ? conditi onal logical eor architecture revision: architecture revision 2 and higher. description performs a bitwise logical exclusive-or between th e specified registers and stores the result in the destination register. operation: i. if ( cond4) rd rx ry; syntax: i. eor{cond4} rd, rx, ry operands: i. {d, x, y} {0, 1, ?, 15} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 11101 ry 31 29 28 25 24 20 19 16 1110 cond4 0100 rd 15 12 11 8 7 0 rx
168 32000d?04/2011 avr32 eorh, eorl ? logical eor into high or low half of register architecture revision: architecture revision1 and higher. description performs a bitwise logical exclusive-or between the high or low halfword in the specified regis- ter and a constant. the result is stored in the destination register. operation: i. rd[31:16] rd[31:16] imm16 ii. rd[15:0] rd[15:0] imm16 syntax: i. eorh rd, imm ii. eorl rd, imm operands: i, ii. d {0, 1, ?, 15} imm {0, 1, ..., 65535} status flags: q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: not affected opcode format i: format ii: 1110 1100001 rd 31 29 28 20 19 16 imm16 15 0 1 1110 1000001 rd 31 29 28 20 19 16 imm16 15 0 1
169 32000d?04/2011 avr32 frs ? flush return stack architecture revision: architecture revision1 and higher. description special instruction to invalidate the return addre ss stack. this instruction is used when the user writes code that conflicts with the semantics required by the return address stack. operation: i. invalidate all entries in the return address stack. syntax: i. frs operands: i. none status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: note: on implementation without a return stack this instru ction will execute as a "nop". 110101110100001 1 15 98 43 0
170 32000d?04/2011 avr32 icall ? indirect call to subroutine architecture revision: architecture revision1 and higher. description call to a subroutine pointed to by the pointer residing in rp. operation: i. lr pc + 2; pc rd; syntax: i. icall rd operands: i. d {0, 1, ?, 15} status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: 010111010001 rd 15 13 12 9 8 4 3 0
171 32000d?04/2011 avr32 incjosp ? increment java operand stack pointer architecture revision: architecture revision1 and higher. description increment the system register "java operand stack pointer" with value. operation: i. if ( josp[3:0] + imm < 0 ) trap 4 else if (josp[3:0] + imm > 8 ) trap 3 else josp josp + imm; syntax: i. incjosp imm operands: i. imm {-4, -3, -2, -1, 1, 2, 3, 4} status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: imm3 imm 100 -4 101 -3 110 -2 111 -1 000 1 001 2 010 3 011 4 110101101 imm3 0011 15 13 12 7 6 4 3 0
172 32000d?04/2011 avr32 note: when trapped, this instruction will destroy r12. it is the progra mmer?s responsibility to keep the r12value if needed.
173 32000d?04/2011 avr32 ld.d ? load doubleword architecture revision: architecture revision1 and higher. description reads the doubleword memory location specified. operation: i. rd+1:rd *(rp); rp rp + 8; ii. rp rp - 8; rd+1:rd *(rp); iii. rd+1:rd *(rp); iv. rd+1:rd *(rp + (se(disp16))); v. r d + 1 : r d *(rb + (ri << sa2)); syntax: i. ld.d rd, rp++ ii. ld.d rd, --rp iii. ld.d rd, rp iv. ld.d rd, rp[disp] v. ld.d rd, rb[ri< 174 32000d?04/2011 avr32 format ii: format iii: format iv: format v: note: format i and ii: if rd = rp, the result is undefined. if rd = rp+1, the result is undefined. 101 rp 10001 rd 0 15 1312 98 6543 10 101 rp 10000 rd 0 15 1312 98 6543 10 111 rp 01110 rd 0 31 29 28 25 24 20 19 16 disp16 15 0 111 rb 00000 ri 31 29 28 25 24 20 19 16 0000001000 shift amount rd 15 12 11 8 7 6 5 4 3 0
175 32000d?04/2011 avr32 ld.sb ? load sign-extended byte architecture revision: architecture revision1 and higher. description reads the byte memory location specified and sign-extends it. operation: i. rd se( *(rp + (se(disp16))) ); ii. rd se( *(rb + (ri << sa2)) ); syntax: i. ld.sb rd, rp[disp] ii. ld.sb rd, rb[ri< 176 32000d?04/2011 avr32 ld.sb{cond4} ? conditional ly load sign-extended byte architecture revision: architecture revision 2 and higher. description reads the byte memory location specified and sign-extends it if the given condition is satisfied. operation: i. if (cond4) rd se( *(rp + (ze(disp9))) ); syntax: i. ld.sb{cond4} rd, rp[disp] operands: i. d, p {0, 1, ?, 15} disp {0, 1, ..., 511} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 11111 31 29 28 25 24 20 19 16 cond4 0 1 1 disp9 15 12 11 8 7 6 5 4 3 0 rd rp
177 32000d?04/2011 avr32 ld.ub ? load zero-extended byte architecture revision: architecture revision1 and higher. description reads the byte memory location specified and zero-extends it. operation: i. rd ze( *(rp) ); rp rp + 1; ii. rp rp - 1; rd ze( *(rp) ); iii. rd ze( *(rp + (ze(disp3))) ); iv. rd ze( *(rp + (se(disp16))) ); v. r d ze( *(rb + (ri << sa2)) ); syntax: i. ld.ub rd, rp++ ii. ld.ub rd, --rp iii. ld.ub rd, rp[disp] iv. ld.ub rd, rp[disp] v. ld.ub rd, rb[ri< 178 32000d?04/2011 avr32 format ii: format iii: format iv: format v: note: format i and ii: if rd = rp, the result is undefined. 000 rp 10111 rd 15 13 12 9 8 4 3 0 000 rp 11 disp3 rd 15 1312 9876 43 0 111 rp 10011 rd 31 29 28 25 24 20 19 16 disp16 15 0 111 rb 00000 ri 31 29 28 25 24 20 19 16 0000011100 shift amount rd 15 12 11 8 7 6 5 4 3 0
179 32000d?04/2011 avr32 ld.ub{cond4} ? conditional ly load zero-extended byte architecture revision: architecture revision 2 and higher. description reads the byte memory location specified and zero-extends it if the given condition is satisfied. operation: i. if (cond4) rd ze( *(rp + (ze(disp9))) ); syntax: i. ld.ub{cond4} rd, rp[disp] operands: i. d, p {0, 1, ?, 15} disp {0, 1, ..., 511} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 11111 31 29 28 25 24 20 19 16 cond4 1 0 0 disp9 15 12 11 8 7 6 5 4 3 0 rd rp
180 32000d?04/2011 avr32 ld.sh ? load sign-extended halfword architecture revision: architecture revision1 and higher. description reads the halfword memory location specified and sign-extends it. operation: i. rd se( *(rp) ); rp rp + 2; ii. rp rp - 2; rd se( *(rp) ); iii. rd se( *(rp + (ze(disp3) << 1)) ); iv. rd se( *(rp + (se(disp16))); v. r d se( *(rb + (ri << sa2)); syntax: i. ld.sh rd, rp++ ii. ld.sh rd, --rp iii. ld.sh rd, rp[disp] iv. ld.sh rd, rp[disp] v. ld.sh rd, rb[ri< 181 32000d?04/2011 avr32 format ii: format iii: format iv: format v: note: format i and ii: if rd = rp, the result is undefined. 000 rp 10101 rd 15 13 12 9 8 4 3 0 100 rp 00 disp3 rd 15 1312 9876 43 0 111 rp 10000 rd 31 29 28 25 24 20 19 16 disp16 15 0 111 rb 00000 ri 31 29 28 25 24 20 19 16 0000010000 shift amount rd 15 12 11 8 7 6 5 4 3 0
182 32000d?04/2011 avr32 ld.sh{cond4} ? conditionally load sign-extended halfword architecture revision: architecture revision 2 and higher. description reads the halfword memory location specified and sign-extends it if the given condition is satis- fied. operation: i. if (cond4) rd se( *(rp + (ze(disp9<<1))) ); syntax: i. ld.sh{cond4} rd, rp[disp] operands: i. d, p {0, 1, ?, 15} disp {0, 2, ..., 1022} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 11111 31 29 28 25 24 20 19 16 cond4 0 0 1 disp9 15 12 11 8 7 6 5 4 3 0 rd rp
183 32000d?04/2011 avr32 ld.uh ? load zero-extended halfword architecture revision: architecture revision1 and higher. description reads the halfword memory location specified and zero-extends it. operation: i. rd ze( *(rp) ); rp rp + 2; ii. rp rp - 2; rd ze( *(rp) ); iii. rd ze( *(rp + (ze(disp3) << 1)) ); iv. rd ze( *(rp + (se(disp16))) ); v. r d ze( *(rb + (ri << sa2)) ); syntax: i. ld.uh rd, rp++ ii. ld.uh rd, --rp iii. ld.uh rd, rp[disp] iv. ld.uh rd, rp[disp] v. ld.uh rd, rb[ri< 184 32000d?04/2011 avr32 format ii: format iii: format iv: format v: note: format i and ii: if rd = rp, the result is undefined. 000 rp 10110 rd 15 13 12 9 8 4 3 0 100 rp 01 disp3 rd 15 1312 9876 43 0 111 rp 10001 rd 31 29 28 25 24 20 19 16 disp16 15 0 111 rb 00000 ri 31 29 28 25 24 20 19 16 0000010100 shift amount rd 15 12 11 8 7 6 5 4 3 0
185 32000d?04/2011 avr32 ld.uh{cond4} ? conditionally load zero-extended halfword architecture revision: architecture revision 2 and higher. description reads the halfword memory location specified and zero-extends it if the given condition is satis- fied. operation: i. if (cond4) rd ze( *(rp + (ze(disp9<<1))) ); syntax: i. ld.uh{cond4} rd, rp[disp] operands: i. d, p {0, 1, ?, 15} disp {0, 2, ..., 1022} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 11111 31 29 28 25 24 20 19 16 cond4 0 1 0 disp9 15 12 11 8 7 6 5 4 3 0 rd rp
186 32000d?04/2011 avr32 ld.w ? load word architecture revision: architecture revision1 and higher. description format i to v: reads the word memory location specified. format vi: this instruction extracts a specified by te from ri. this value is zero-extended, shifted left two positions and added to rb to form an address. the contents of this address is loaded into rd. the instruction is useful for indexing tables. operation: i. rd *(rp); rp rp + 4; ii. rp rp - 4; rd *(rp); iii. rd *(rp + (ze(disp5) << 2)); iv. rd *(rp + (se(disp16))); v. r d *(rb + (ri << sa2)); vi. if (part == b) rd *(rb + (ri[7:0] << 2) ); else if (part == l) rd *(rb + (ri[15:8] << 2) ); else if (part == u) rd *(rb + (ri[23:16] << 2) ); else rd *(rb + (ri[31:24] << 2) ); syntax: i. ld.w rd, rp++ ii. ld.w rd, --rp iii. ld.w rd, rp[disp] iv. ld.w rd, rp[disp] v. ld.w rd, rb[ri< << 2] operands: i-v. d, p, b, i {0, 1, ?, 15} iii. disp {0, 4, ..., 124} iv. disp {-32768, -32767, ..., 32767} v. sa {0, 1, 2, 3} vi. {d, b, i} {0, 1, ?, 15} part {t, u, l, b}
187 32000d?04/2011 avr32 status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: format iii: format iv: format v: format vi: note: format i and ii: if rd = rp, the result is undefined. 000 rp 10000 rd 15 13 12 9 8 4 3 0 000 rp 10100 rd 15 13 12 9 8 4 3 0 011 rp disp5 rd 15 13 12 9 8 4 3 0 111 rp 01111 rd 31 29 28 25 24 20 19 16 disp16 15 0 111 rb 00000 ri 31 29 28 25 24 20 19 16 0000001100 shift amount rd 15 12 11 8 7 6 5 4 3 0 111 rb 00000 ri 31 29 28 25 24 20 19 16 0000111110xy rd 15 12 11 6 5 4 3 0
188 32000d?04/2011 avr32
189 32000d?04/2011 avr32 ld.w{cond4} ? condi tionally load word architecture revision: architecture revision 2 and higher. description reads the word memory location specifi ed if the given condition is satisfied. operation: i. if (cond4) rd *(rp + (ze(disp9<<2))); syntax: i. ld.w{cond4} rd, rp[disp] operands: i. d, p {0, 1, ?, 15} disp {0, 4, ..., 2044} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 11111 31 29 28 25 24 20 19 16 cond4 0 0 0 disp9 15 12 11 8 7 6 5 4 3 0 rd rp
190 32000d?04/2011 avr32 ldc.{d,w} ? load coprocessor architecture revision: architecture revision1 and higher. description reads the memory location specified into the addressed coprocessor. operation: i. cp#(crd+1:crd) *(rp + (ze(disp8) << 2)); ii. rp rp-8; cp#(crd+1:crd) *(rp); iii. cp#(crd+1:crd) *(rb + (ri << sa2)); iv. cp#(crd) *(rp + (ze(disp8) << 2)); v. r p rp-4; cp#(crd) *(rp); vi. cp#(crd) *(rb + (ri << sa2)); syntax: i. ldc.d cp#, crd, rp[disp] ii. ldc.d cp#, crd, --rp iii. ldc.d cp#, crd, rb[ri< 191 32000d?04/2011 avr32 format i: format ii: format iii: format iv: format v: format vi: example: ldc.d cp2, cr0, r2[0] 1110 0011010 rp 31 29 28 25 24 20 19 16 cp # 1 crd[3:1] 0 disp8 15 13 12 11 8 7 0 1 1110 1111010 rp 31 29 28 25 24 20 19 16 cp # 0crd[3:1] 001010 00 15 13 12 11 9 8 7 0 1 0 1110 1111010 rp 31 29 28 25 24 20 19 16 cp # 1 crd[3:1] 0 0 1 sh amt ri 15 13 12 11 9 8 7 6 5 4 3 0 1 1110 0011010 rp 31 29 28 25 24 20 19 16 cp # 0 crd k8 15 13 12 11 8 7 0 1 1110 1111010 rp 31 29 28 25 24 20 19 16 cp # 0 01000 00 15 13 12 11 8 7 0 1 0 crd 1110 1111010 rp 31 29 28 25 24 20 19 16 cp # 1 0 0 sh amt ri 15 13 12 11 8 7 6 5 4 3 0 1 crd
192 32000d?04/2011 avr32 ldc0.{d,w} ? load coprocessor 0 architecture revision: architecture revision1 and higher. description reads the memory location sp ecified into coprocessor 0. operation: i. cp0(crd+1:crd) *(rp + (ze(disp12) << 2)); ii. cp0(crd) *(rp + (ze(disp12) << 2)); syntax: i. ldc0.d crd, rp[disp] ii. ldc0.w crd, rp[disp] operands: i,ii p {0, 1, ?, 15} i. d {0, 2, ?, 14} ii. d {0, 1, ?, 15} i, ii. disp {0, 4, ?, 16380} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: example: ldc0.d cr0, r2[0] 1111 0111010 rp 31 29 28 25 24 20 19 16 disp[11:8] crd[3:1] 0 disp[7:0] 15 13 12 11 8 7 0 0 1111 0011010 rp 31 29 28 25 24 20 19 16 disp[11:8] crd disp[7:0] 15 12 11 8 7 0 0
193 32000d?04/2011 avr32 ldcm.{d,w} ? load coprocesso r multiple registers architecture revision: architecture revision1 and higher. description reads the memory locations specified into the addressed coprocessor. the pointer register can optionally be updated after the operation. operation: i. loadaddress rp; for (i = 7 to 0) if reglistcpd8[i] == 1 then cp#(cr(2*i+1)) *(loadaddress++); cp#(cr(2*i)) *(loadaddress++); if opcode[++] == 1 then rp loadaddress; ii. loadaddress rp; for (i = 7 to 0) if reglistcph8[i] == 1 then cp#(cri+8) *(loadaddress++); if opcode[++] == 1 then rp loadaddress; iii. loadaddress rp; for (i = 7 to 0) if reglistcpl8[i] == 1 then cp#(cri) *(loadaddress++); if opcode[++] == 1 then rp loadaddress; syntax: i. ldcm.d cp#, rp{++}, reglistcpd8 ii. ldcm.w cp#, rp{++}, reglistcph8 iii. ldcm.w cp#, rp{++}, reglistcpl8 operands: i-iii. # {0, 1, ?, 7} p {0, 1, ?, 15} i. reglistcpd8 {cr0-cr1,cr2-cr3,cr4- cr5,cr6-cr7,cr8-cr9, cr10-cr11,cr12-cr13,cr14-cr15} ii. reglistcph8 {cr8, cr9, cr10, ..., cr15} iii. reglistcpl8 {cr0, cr1, cr2, ..., cr7}
194 32000d?04/2011 avr32 status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: format iii: example: ldcm.w cp2, sp++, cr2-cr5 note: emtpy reglistcpl8/reglistcpl8/reglistcpd8 gives undefined result. 1110 1011010 rp 31 29 28 25 24 20 19 16 cp# ++0100 cr 15 13 12 11 8 7 0 1 15-14 cr 13-12 cr 11-10 cr 9-8 cr 7-6 cr 5-4 cr 3-2 cr 1-0 1110 1011010 rp 31 29 28 25 24 20 19 16 cp# ++0001 cr 15 13 12 11 8 7 0 1 15 cr 14 cr 13 cr 12 cr 11 cr 10 cr 9 cr 8 1110 1011010 rp 31 29 28 25 24 20 19 16 cp# ++0000 cr 15 13 12 11 8 7 0 1 7 cr 6 cr 5 cr 4 cr 3 cr 2 cr 1 cr 0
195 32000d?04/2011 avr32 lddpc ? load pc-relat ive with displacement architecture revision: architecture revision1 and higher. description performs a pc relative load of a register operation: i. rd *( (pc && 0xffff_fffc) + (ze(disp7) << 2)); syntax: i. lddpc rd, pc[disp] operands: i. d {0, 1, ?, 15} disp {0, 4, ?, 508} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 01001 disp7 rd 15 13 12 11 10 4 3 0
196 32000d?04/2011 avr32 lddsp ? load sp-relat ive with displacement architecture revision: architecture revision1 and higher. description reads the value of a memory location referred to by the stack pointer register and a displace- ment. operation: i. rd *( (sp && 0xffff_fffc) + (ze(disp7) << 2)); syntax: i. lddsp rd, sp[disp] operands: i. d {0, 1, ?, 15} disp {0, 4, ?, 508} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 01000 disp7 rd 15 13 12 11 10 4 3 0
197 32000d?04/2011 avr32 ldins.{b,h} ? load and insert byte or halfword into register architecture revision: architecture revision1 and higher. description this instruction loads a byte or a halfword from memory and inserts it into the addressed byte or halfword position in rd. the other parts of rd are unaffected. operation: i. if (part == b) rd[7:0] *(rp+se(disp12)); else if (part == l) rd[15:8] *(rp+se(disp12)); else if (part == u) rd[23:16] *(rp+se(disp12)); else rd[31:24] *(rp+se(disp12)); ii. if (part == b) rd[15:0] *(rp+se(disp12) << 1); else rd[31:16] *(rp+se(disp12) << 1); syntax: i. ldins.b rd:, rp[disp] ii. ldins.h rd:, rp[disp] operands: i. {p, d} {0, 1, ?, 15} part {t, u, l, b} disp {-2048, -2047, ..., 2047} ii. {p, d} {0, 1, ?, 15} part {t, b} disp {-4096, -4094, ..., 4094} status flags: q: not affected v: not affected n: not affected z: not affected c: not affected
198 32000d?04/2011 avr32 opcode: format i: format ii: 111 rp 11101 rd 31 29 28 25 24 20 19 16 0 1 part disp12 15 14 13 12 11 0 111 rp 11101 rd 31 29 28 25 24 20 19 16 0 0 0 part disp12 15 13 12 11 0
199 32000d?04/2011 avr32 ldm ? load multiple registers architecture revision: architecture revision1 and higher. description loads the consecutive words pointed to by rp into the registers specified in the instruction. the pc can be loaded, resulting in a jump to the loaded target address. if pc is loaded, the return value in r12 is tested and the flags are updated. the return value may optionally be set to -1, 0 or 1. operation: i. loadaddress rp; if reglist16[pc] == 1 then if rp == pc then loadaddress sp; pc *(loadaddress++); if rp == pc then if reglist16[lr,r12] == b?00 r12 0; else if reglist16[lr,r12] == b?01 r12 1; else r12 ?1; test r12 and update flags; else if reglist16[lr] == 1 lr *(loadaddress++); if reglist16[sp] == 1 sp *(loadaddress++); if reglist16[r12] == 1 r 12 *(loadaddress++); test r12 and update flags; else if reglist16[lr] == 1 lr *(loadaddress++); if reglist16[sp] == 1 sp *(loadaddress++); if reglist16[r12] == 1 r 12 *(loadaddress++); for (i = 11 to 0) if reglist16[i] == 1 then ri *(loadaddress++); if opcode[++] == 1 then if rp == pc then sp loadaddress; else rp loadaddress;
200 32000d?04/2011 avr32 syntax: i. ldm rp{++}, reglist16 operands: i. reglist16 {r0, r1, r2, ..., r12, lr, sp, pc} p {0, 1, ?, 15} status flags: flags are only updated if reglist16[pc] == 1. they are set as the result of the operation cp r12, 0. q: not affected v: v 0 n: n res[31] z: z (res[31:0] == 0) c: c 0 opcode: note: emtpy reglist16 gives undefined result. if rp is in reglist16 an d pointer is written back the result is undefined. the r bit in the status register has no effect on this instruction. 1110 0++11100 rp 31 29 28 26 25 24 20 19 16 r15 r14 r13 r12 r11 r10 r9 r8 r7 r6 r5 r4 r3 r2 r1 r0 15 0 0
201 32000d?04/2011 avr32 ldmts ? load multiple regi sters for task switch architecture revision: architecture revision1 and higher. description loads the consecutive words pointed to by rp into the registers specified in the instruction.the target registers reside in the user register context, regardless of which context the instruction is called from. operation: i. loadaddress rp; for (i = 15 to 0) if reglist16[i] == 1 then ri user *(loadaddress++); if opcode[++] == 1 then rp loadaddress; syntax: i. ldmts rp{++}, reglist16 operands: i. reglist16 {r0, r1, r2, ..., r12, lr, sp} p {0, 1, ?, 15} status flags: not affected. opcode: note: this instruction is intended for performing task switches. emtpy reglist16 gives undefined result. pc in reglist16 gives undefined result. 1110 1++11100 rp 31 29 28 26 25 24 20 19 16 r15 r14 r13 r12 r11 r10 r9 r8 r7 r6 r5 r4 r3 r2 r1 r0 15 0 0
202 32000d?04/2011 avr32 ldswp.{sh, uh, w} ? load and swap architecture revision: architecture revision1 and higher. description this instruction loads a halfword or a word from memory. if a halfword load is performed, the loaded value is zero- or sign-extended. the bytes in the loaded value are shuffled and the result is written back to rd. the instruction can be used for performing loads from memories of differ- ent endianness. operation: i. temp[15:0] *(rp+se(disp12) << 1); rd se(temp[7:0], temp[15:8]); ii. temp[15:0] *(rp+se(disp12) << 1); rd ze(temp[7:0], temp[15:8]); iii. temp *(rp+se(disp12) << 2); rd (temp[7:0], temp[15:8], temp[23:16], temp[31:24]); syntax: i. ldswp.shrd, rp[disp] ii. ldswp.uhrd, rp[disp] iii. ldswp.w rd, rp[disp] operands: i, ii. {d, p} {0, 1, ?, 15} disp {-4096, -4094, ..., 4094} iii. {d, p} {0, 1, ?, 15} disp {-8192, -8188, ..., 8188} status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: format i: 111 rp 11101 rd 31 29 28 25 24 20 19 16 0010 disp12 15 12 11 0
203 32000d?04/2011 avr32 format ii: format iii: 111 rp 11101 rd 31 29 28 25 24 20 19 16 0011 disp12 15 12 11 0 111 rp 11101 rd 31 29 28 25 24 20 19 16 1000 disp12 15 12 11 0
204 32000d?04/2011 avr32 lsl ? logical shift left architecture revision: architecture revision1 and higher. description shifts all bits in a register the amount of bits specified to the left. the shift amount can reside in a register or be specified as an immediate. zeros are shifted into the lsbs. the last bit that is shifted out is placed in c. operation: i. rd lsl(rx, ry[4:0]); ii. rd lsl(rd, sa5); iii. rd lsl(rs, sa5); syntax: i. lsl rd, rx, ry ii. lsl rd, sa iii. lsl rd, rs, sa operands: i. {d, x, y} {0, 1, ?, 15} ii. d {0, 1, ?, 15} sa {0, 1, ?, 31} iii. {d,s} {0, 1, ?, 15} sa {0, 1, ?, 31} status flags: format i: shamt = ry[4:0], op = rx format ii: shamt = sa5, op = rd format iii: shamt = sa5, op = rs q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: if shamt != 0 c op[32-shamt] else c 0 opcode:
205 32000d?04/2011 avr32 format i: format ii: format iii: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000010010100 rd 15 12 11 4 3 0 101 bit[4:1] 1011bit[0] rd 15 1312 98 543 0 111 rs 00000 rd 31 29 28 25 24 20 19 16 00010101000 sa5 15 12 11 8 7 5 4 0
206 32000d?04/2011 avr32 lsr ? logical shift right architecture revision: architecture revision1 and higher. description shifts all bits in a register the amount specified to the right. the shift amount may be specified by a register or an immediate. zeros are shifted into the msb. operation: i. rd lsr(rx, ry[4:0]); ii. rd lsr(rd, sa5); iii. rd lsr(rs, sa5); syntax: i. lsr rd, rx, ry ii. lsr rd, sa iii. lsr rd, rs, sa operands: i. {d, x, y} {0, 1, ?, 15} ii. d {0, 1, ?, 15} sa {0, 1, ?, 31} iii. {d,s} {0, 1, ?, 15} sa {0, 1, ?, 31} status flags: format i: shamt = ry[4:0], op = rx format ii: shamt = sa5, op = rd format iii: shamt = sa5, op = rs q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: if shamt != 0 c op[shamt-1] else c 0
207 32000d?04/2011 avr32 opcode: format i: format ii: format iii: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000010100100 rd 15 12 11 4 3 0 101 bit[4:0] 1100bit[0] rd 15 1312 98 543 0 111 rs 00000 rd 31 29 28 25 24 20 19 16 00010110000 sa5 15 12 11 8 7 5 4 0
208 32000d?04/2011 avr32 mac ? multiply accumulate architecture revision: architecture revision1 and higher. description performs a multiply-accumulate operation and stores the result into the destination register. operation: i. rd (rx ry) + rd; syntax: i. mac rd, rx, ry operands: {d, x, y} {0, 1, ?, 15} status flags q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000000110100 rd 15 12 11 4 3 0
209 32000d?04/2011 avr32 machh.d ? multiply halfwor ds and accumulate in doubleword architecture revision: architecture revision1 and higher. description multiplies the two halfword registers specified and adds the result to the specified doubleword- register. only the 48 highest of the 64 possible bits in the doubleword accumulator are used. the 16 lowest bits are cleared. the halfword registers are selected as either the high or low part of the operand registers. operation: i. if (rx-part == t) then operand1 = se(rx[31:16]) else operand1 = se(rx[15:0]); if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); (rd+1:rd)[63:16] (operand1 operand2)[31:0] + (rd+1:rd)[63:16]; rd[15:0] 0; syntax: i. machh.d rd, rx:, ry: operands: i. d {0, 2, 4, ?, 14} {x, y} {0, 1, ?, 15} part {t,b} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: example: machh.d r10, r2:t, r3:b will perform (r11 : r10)[63:16] ( se(r2[31:16]) se(r3[15:0]) ) + (r11 : r10)[63:16] r10[15:0] 0 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000010110xy rd 15 12 11 8 7 6 5 4 3 0
210 32000d?04/2011 avr32 machh.w ? multiply halfwo rds and accumulate in word architecture revision: architecture revision1 and higher. description multiplies the two halfword registers specified and adds the result to the specified word-register. the halfword registers are selected as either the high or low part of the operand registers. operation: i. if (rx-part == t) then operand1 = se(rx[31:16]) else operand1 = se(rx[15:0]); if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); rd (operand1 operand2) + rd; syntax: i. machh.w rd, rx:, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: example: machh.w r10, r2:t, r3:b will perform r10 ( se(r2[31:16]) se(r3[15:0]) ) + r10 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000010010xy rd 15 12 11 8 7 6 5 4 3 0
211 32000d?04/2011 avr32 macs.d ? multiply accumulate signed architecture revision: architecture revision1 and higher. description performs a multiply-accumulate operation with signed numbers and stores the result into the destination registers. operation: i. acc (rd+1:rd); prod (rx ry); res prod + acc; (rd+1:rd) res; syntax: i. macs.d rd, rx, ry operands: i. d {0, 2, 4, ?, 14} {x, y} {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000001010100 rd 15 12 11 4 3 0
212 32000d?04/2011 avr32 macsathh.w ? multiply-accumulate ha lfwords with saturation into word architecture revision: architecture revision1 and higher. description multiplies the two halfword registers specified, shifts the results one position to the left and stores the result as a temporary word-sized product. if the two operands equals -1, the product is saturated to the largest positive 32-bit fractional number. the halfword registers are selected as either the high or low part of the operand registers. the temporary product is added with sat- uration to rd. operation: i. if (rx-part == t) then operand1 = se(rx[31:16]) else operand1 = se(rx[15:0]); if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); if (operand1 == operand2 == 0x8000) product 0x7fff_ffff; else product (operand1 operand2) << 1; rd sat(product + rd); syntax: i. macsathh.w rd, rx:, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: set if saturation occurred, or if the accumulation overflows, or previously set. v: not affected. n: not affected. z: not affected. c: not affected. opcode: example: macsathh.wr10, r2:t, r3:b will perform r10 sat (sat(( se(r2[31:16]) se(r3[15:0]) ) << 1) + r10) 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000011010xy rd 15 12 11 8 7 6 5 4 3 0
213 32000d?04/2011 avr32 macu.d ? multiply accumulate unsigned architecture revision: architecture revision1 and higher. description performs a multiply-accumulate operation with unsigned numbers and stores the result into the destination registers. operation: i. acc (rd+1:rd); prod (rx ry); res prod + acc; (rd+1:rd) res; syntax: i. macu.d rd, rx, ry operands: i. d {0, 2, 4, ?, 14} {x, y} {0, 1, ?, 15} status flags q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000001110100 rd 15 12 11 4 3 0
214 32000d?04/2011 avr32 macwh.d ? multiply word with half word and accumulate in doubleword architecture revision: architecture revision1 and higher. description multiplies the word and halfword register specified and adds the result to the specified double- word-register. the halfword register is selected as either the high or low part of ry. only the 48 highest of the 64 possible bits in the doubleword accumulator are used. the 16 lowest bits are cleared. operation: i. operand1 = rx; if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); (rd+1:rd)[63:16] (operand1 operand2)[47:0] + (rd+1:rd)[63:16]; rd[15:0] 0; syntax: i. macwh.d rd, rx, ry: operands: i. d {0, 2, ?, 14} {x, y} {0, 1, ?, 15} part {t,b} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: example: macwh.dr10, r2, r3:bwill perform (r11:r10)[63:16] (r2 se(r3[15:0])) + (r11:r10)[63:16] r10[15:0] 0 111 rx 00000 ry 31 29 28 25 24 20 19 16 00001100100y rd 15 12 11 8 7 5 4 3 0
215 32000d?04/2011 avr32 max ? return maximum value architecture revision: architecture revision1 and higher. description sets rd equal to the signed maximum of rx and ry. operation: i. if rx > ry rd rx; else rd ry; syntax: i. max rd, rx, ry operands: d, x, y {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000011000100 rd 15 12 11 4 3 0
216 32000d?04/2011 avr32 mcall ? subroutine call architecture revision: architecture revision1 and higher. description subroutine call to a call destination specified in a location residing in memory. operation: i. lr pc + 4 pc *((rp & 0xfffffffc) + (se(disp16) << 2)) syntax: i. mcall rp[disp] operands: p {0, 1, ?, 15} disp {-131072, -131068,?, 131068} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111100000001 rp 31 29 28 20 19 16 disp16 15 0
217 32000d?04/2011 avr32 memc ? clear bit in memory architecture revision: architecture revision1 and higher. description performs a read-modify-write operation to clear an arbitrary bit in memory. the word to modify is pointed to by a signed 17-bit address. this allows the instruct ion to address the upper 64kb and lower 64kb of mem- ory. this instruction is part of the optional rmw instruction set. operation: i. *(se(imm15<<2)[bp5]) 0 syntax: i. memc imm, bp5 operands: bp5 {0, 1, ?, 31} imm {-65536, -65532,?, 65532} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 1111 1100001 bp5[4:1] 31 20 19 16 b5[0] imm15 15 14 0 0
218 32000d?04/2011 avr32 mems ? set bit in memory architecture revision: architecture revision1 and higher. description performs a read-modify-write operation to set an arbitr ary bit in memory. the word to modify is pointed to by a signed 17-bit address. this allows the instruct ion to address the upper 64kb and lower 64kb of mem- ory. this instruction is part of the optional rmw instruction set. operation: i. *(se(imm15<<2)[bp5]) 1 syntax: i. mems imm, bp5 operands: bp5 {0, 1, ?, 31} imm {-65536, -65532,?, 65532} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 1111 0000001 bp5[4:1] 31 20 19 16 b5[0] imm15 15 14 0 1
219 32000d?04/2011 avr32 memt ? toggle bit in memory architecture revision: architecture revision1 and higher. description performs a read-modify-write operation to toggle an arbitrary bit in memory. the word to modify is pointed to by a signed 17-bit address. this allows the instruction to address the upper 64kb and lower 64kb of memory. this instruction is part of the optional rmw instruction set. operation: i. *(se(imm15<<2)[bp5]) ? *(se(k15<<2)[bp5]) syntax: i. memt imm, bp5 operands: bp5 {0, 1, ?, 31} imm {-65536, -65532,?, 65532} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 1111 0100001 bp5[4:1] 31 20 19 16 b5[0] imm15 15 14 0 1
220 32000d?04/2011 avr32 mfdr ? move from debug register architecture revision: architecture revision1 and higher. description the instruction copies the value in the specified debug register to the specified register in the register file. note that special timing concerns must be considered when operating on the debug registers, see the pipeline chapter for details. operation: i. rd debugregister[debugregisteraddress << 2]; syntax: i. mfdr rd, debugregisterno operands: i. debugregisterno {0, 4, 8, ..., 1020} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: note: debug registers are implementation defined. if accessing a debug register that does not exist, the result is undefined. this instruction can only be executed in a priv ileged mode. execution from any other mode will trigger a privilege violation exception. 111001011011 rd 31 20 19 16 00000000 debug register ad- 15 8 7 0
221 32000d?04/2011 avr32 mfsr ? move from system register architecture revision: architecture revision1 and higher. description the instruction copies the value in the specified system register to the specified register in the register file. note that special timing concerns must be considered when operating on the sys- tem registers, see the pipeline chapter for details. operation: i. rd systemregister[systemregisteraddress << 2]; syntax: i. mfsr rd, systemregisteraddress operands: i. systemregisteraddress {0, 4, 8, ..., 1020} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: note: some system registers are implementation defined. if accessing a system register that does not exist, the result is undefined. with the exception of accessing the jecr and josp system registers, this instruction can only be executed in a privileged mode. execution from any other mode will trigger a privilege viola- tion exception. jecr and josp can be accessed from all modes with this instruction. 111000011011 rd 31 20 19 16 00000000 system register ad- 15 8 7 0
222 32000d?04/2011 avr32 min ? return minimum value architecture revision: architecture revision1 and higher. description sets rd equal to the signed minimum of rx and ry. operation: i. if rx < ry rd rx; else rd ry; syntax: i. min rd, rx, ry operands: d, x, y {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 rx 00000 rd 31 29 28 25 24 20 19 16 000011010100 rd 15 12 11 4 3 0
223 32000d?04/2011 avr32 mov ? move data into register architecture revision: architecture revision1 and higher. description moves a value into a register. the value may be an immediate or the contents of another regis- ter. note that rd may specify pc, resu lting in a jump. all flags are unchanged. operation: i. rd se(imm8); ii. rd se(imm21); iii. rd rs; syntax: i. mov rd, imm ii. mov rd, imm iii. mov rd, rs operands: i. d {0, 1, ?, 15} imm {-128, -127, ..., 127} ii. d {0, 1, ?, 15} imm {-1048576, -104875, ..., 1048575} iii. d, s {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: 0011 imm8 rd 15 13 12 11 4 3 0 111 imm21[20:17 0011 imm21 rd 31 29 28 25 24 21 20 19 16 imm21[15:0] 15 0 [16]
224 32000d?04/2011 avr32 format iii: 000 rs 01001 rd 15 13 12 9 8 4 3 0
225 32000d?04/2011 avr32 mov{cond4} ? condit ional move register architecture revision: architecture revision1 and higher. description copies the contents of the source register or immediate to the destination register. the source register is unchanged. all flags are unchanged. operation: i. if ( cond4) rd rs; ii. if ( cond4) rd se(imm8); syntax: i. mov{cond4} rd, rs ii. mov{cond4} rd, imm operands: i. {d, s} {0, 1, ?, 15} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} ii. d {0, 1, ?, 15} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} imm {-128, -127, ..., 127} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 rs 00000 rd 31 29 28 25 24 20 19 16 00010111 cond4 0000 15 12 11 8 7 4 3 0
226 32000d?04/2011 avr32 format ii: 1111 0011011 rd 31 29 28 25 24 20 19 16 0000 cond4 imm8 15 12 11 8 7 0 1
227 32000d?04/2011 avr32 movh ? move data into high halfword of register architecture revision: architecture revision 2 and higher. description moves a value into the high halfword of a register. the low halfword is cleared. all flags are unchanged. operation: i. rd imm16<<16; syntax: i. movh rd, imm operands: i. d {0, 1, ?, 15} imm {0, 1, ..., 65535} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 11111 00000 rd 31 29 28 25 24 20 19 16 imm16 15 0 1 1
228 32000d?04/2011 avr32 mtdr ? move to debug register architecture revision: architecture revision1 and higher. description the instruction copies the value in the specified register to the specified debug register. note that special timing concerns must be considered when operating on the system registers, see the pipeline chapter for details. operation: i. debugregister[debugregisteraddress << 2] rs; syntax: i. mtdr debugregisteraddress, rs operands: i. debugregisteraddress {0, 4, 8, ..., 1020} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: note: the debug registers are implementation defined, and updates of these registers are handled in an implementation specific way. this instruction can only be executed in a pr ivileged mode. ex ecution from any other mode will trigger a privilege violation exception. 111001111011 rs 31 20 19 16 00000000 debug register ad- 15 8 7 0
229 32000d?04/2011 avr32 mtsr ? move to system register architecture revision: architecture revision1 and higher. description the instruction copies the value in the specified register to the specified system register. note that special timing concerns must be considered when operating on the system registers, see the implementation manual for details. operation: i. systemregister[systemregisteraddress << 2] rs; syntax: i. mtsr systemregisteraddress, rs operands: i. systemregisteraddress {0, 4, 8, ..., 1020} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: note: some system registers are implementation defined. if writing a system register that does not exist, or to a register that is read only, the instruction is executed but no registers are updated. with the exception of accessing the jecr and josp system registers, this instruction can only be executed in a privileged mode. execution from any other mode will trigger a privilege viola- tion exception. jecr and josp can be accessed from all modes with this instruction. the instruction mtsr josp, rx must be used with care. the programmer must ensure that no change of flow instruction nor an incjosp instruction follows mtsr josp, rx within a number of instructions. this number of cycles is implementation defined. it should also be noted, that this is true even if the instructions are not to be executed. for instance the sequence mtsr josp, rx retj incjosp 111000111011 rs 31 20 19 16 00000000 system register ad- 15 8 7 0
230 32000d?04/2011 avr32 will execute with an incorrect result . in practice this warning will only affect programmers writing their own java virtual machine based on the avr32 java extension module.
231 32000d?04/2011 avr32 mul ? multiply architecture revision: architecture revision1 and higher. description multiplies the specified operands and stores the result in the destination register. operation: i. rd rd rs; ii. rd rx ry; iii. rd rs se(imm8) syntax: i. mul rd, rs ii. mul rd, rx, ry iii. mul rd, rs, imm operands: i. {d, s} {0, 1, ?, 15} ii. {d, x, y} {0, 1, ?, 15} iii. {d, s} {0, 1, ?, 15} imm {-128, -127, ..., 127} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: 101 rs 10011 rd 15 13 12 9 8 4 3 0 111 rx 00000 ry 31 29 28 25 24 20 19 16 000000100100 rd 15 12 11 4 3 0
232 32000d?04/2011 avr32 format iii: 111 rs 00000 rd 31 29 28 25 24 20 19 16 00010000 imm8 15 12 11 8 7 0
233 32000d?04/2011 avr32 mulhh.w ? multiply ha lfword with halfword architecture revision: architecture revision1 and higher. description multiplies the two halfword registers specified and stores the result in the destination word-regis- ter. the halfword registers are selected as either the high or low part of the operand registers. operation: i. if (rx-part == t) then operand1 = se(rx[31:16]) else operand1 = se(rx[15:0]); if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); rd operand1 operand2; syntax: i. mulhh.w rd, rx:, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: example: mulhh.wr10, r2:t, r3:b will perform r10 se(r2[31:16]) se(r3[15:0]) 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000011110xy rd 15 876543 0
234 32000d?04/2011 avr32 mulnhh.w ? multiply half word with negated halfword architecture revision: architecture revision1 and higher. description multiplies the two halfword registers specified and stores the result in the destination word-regis- ter. the halfword registers are selected as either the high or low part of the operand registers. the result is negated. operation: i. if (rx-part == t) then operand1 = se(rx[31:16]) else operand1 = se(rx[15:0]); if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); rd - (operand1 operand2); syntax: i. mulnhh.w rd, rx:, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000000110xy rd 15 876543 0
235 32000d?04/2011 avr32 mulnwh.d ? multiply word with negated halfword architecture revision: architecture revision1 and higher. description multiplies the word register with the halfword register specified and stores the negated result in the destination register pair. the halfword register is selected as either the high or low part of ry. since the most significant part of the product is st ored, no overflow will occur. operation: i. operand1 = rx; if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); (rd+1:rd)[63:16] - (operand1 operand2); rd[15:0] 0; syntax: i. mulnwh.d rd, rx, ry: operands: i. d {0, 2, 4, ?, 14} {x, y} {0, 1, ?, 15} part {t,b} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 00000010100y rd 15 12 11 8 7 5 4 3 0
236 32000d?04/2011 avr32 muls.d ? multiply signed architecture revision: architecture revision1 and higher. description multiplies the two registers specified and stores the result in the destination registers. operation: i. rd+1:rd rx ry; syntax: i. muls.d rd, rx, ry operands: i. d {0, 2, 4, ?, 14} {x, y} {0, 1, ?, 15} status flags q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000001000100 rd 15 12 11 4 3 0
237 32000d?04/2011 avr32 mulsathh.h ? multiply halfwords with saturation into halfword architecture revision: architecture revision1 and higher. description multiplies the two halfword registers specified, shifts the results one position to the left and stores the sign-extended high halfword of the result in the destination word-register. if the two operands equals -1, the result is saturated to the largest positive 16-bit fractional number. the halfword registers are selected as either the high or low part of the operand registers. operation: i. if (rx-part == t) then operand1 = se(rx[31:16]) else operand1 = se(rx[15:0]); if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); if (operand1 == operand2 == 0x8000) rd 0x7fff; else rd se( (operand1 operand2) >> 15 ); syntax: i. mulsathh.h rd, rx:, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: set if saturation occurred, or previously set. v: not affected. n: not affected. z: not affected. c: not affected. opcode: example: mulsathh.h r10, r2:t, r3:b will perform r10 se( sat(se(r2[31:16]) se(r3[15:0]) ) >> 15 ) 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000100010xy rd 15 12 11 8 7 6 5 4 3 0
238 32000d?04/2011 avr32 mulsathh.w ? multiply halfwords with saturation into word architecture revision: architecture revision1 and higher. description multiplies the two halfword registers specified, shifts the results one position to the left and stores the result in the destination word-register. if the two operands equals -1, the result is sat- urated to the largest positive 32-bit fractional number. the halfword registers are selected as either the high or low part of the operand registers. operation: i. if (rx-part == t) then operand1 = se(rx[31:16]) else operand1 = se(rx[15:0]); if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); if (operand1 == operand2 == 0x8000) rd 0x7fff_ffff; else rd (operand1 operand2) << 1; syntax: i. mulsathh.w rd, rx:, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: set if saturation occurred, or previously set. v: not affected. n: not affected. z: not affected. c: not affected. opcode: example: mulsathh.w r10, r2:t, r3:b will perform r10 sat( (se(r2[31:16]) se(r3[15:0] )) << 1) 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000100110xy rd 15 12 11 8 7 6 5 4 3 0
239 32000d?04/2011 avr32 mulsatrndhh.h ? multiply halfwor ds with saturati on and rounding into halfword architecture revision: architecture revision1 and higher. description multiplies the two halfword registers specified, shifts the results one position to the left and stores the result in the destination word-register. if the two operands equal -1, the result is satu- rated to the largest positive 16-bit fractional number. the halfword registers are selected as either the high or low part of the operand registers. the product is rounded. operation: i. if (rx-part == t) then operand1 = se(rx[31:16]) else operand1 = se(rx[15:0]); if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); if (operand1 == operand2 == 0x8000) rd 0x7fff; else rd se( ((operand1 operand2) + 0x4000 ) >> 15 ); syntax: i. mulsatrndhh.h rd, rx:, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: set if saturation occurred, or previously set. v: not affected. n: not affected. z: not affected. c: not affected. opcode: example: mulsatrndhh.h r10, r2:t, r3:b will perform r10 se( sat( se(r2[31:16]) se(r3[15:0]) ) + 0x4000) >> 15) 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000101010xy rd 15 12 11 8 7 6 5 4 3 0
240 32000d?04/2011 avr32 mulsatrndwh.w ? multiply word and halfword with saturation and rounding into word architecture revision: architecture revision1 and higher. description multiplies the word register with the halfword register specified, rounds the upper 32 bits of the result and stores it in the destination word-regis ter. the halfword register is selected as either the high or low part of ry. since the most significant part of the product is stored, no overflow will occur. if the two operands equals -1, the result is saturated to the largest positive 32-bit fractional number. operation: i. operand1 = rx; if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); if ((operand1 == 0x8000_0000) && (operand2 == 0x8000)) rd 0x7fff_ffff; else rd se( ((operand1 operand2) + 0x4000 ) >> 15 ); syntax: i. mulsatrndwh.w rd, rx, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: set if saturation occurred, or previously set. v: not affected. n: not affected. z: not affected. c: not affected. opcode: example: mulsatrndwh.w r10, r2, r3b will perform r10 (sat( r2[31:16] se(r3[15:0]) ) + 0x4000) >> 15 111 rx 00000 ry 31 29 28 25 24 20 19 16 00001011100y rd 15 12 11 8 7 5 4 3 0
241 32000d?04/2011 avr32 mulsatwh.w ? multiply word and ha lfword with saturation into word architecture revision: architecture revision1 and higher. description multiplies the word register with the halfword register specified and stores the upper 32 bits of the result in the destination word-register. the halfword register is selected as either the high or low part of ry. since the most significant part of the product is st ored, no overflow will occur. if the two operands equal -1, the result is saturated to the largest positive 32-bit fractional number. operation: i. operand1 = rx; if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); if ((operand1 == 0x8000_0000) && (operand2 == 0x8000)) rd 0x7fff_ffff; else rd (operand1 operand2) >> 15; syntax: i. mulsatwh.w rd, rx, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: set if saturation occurred, or previously set. v: not affected. n: not affected. z: not affected. c: not affected. opcode: example: mulsatwh.wr10, r2, r3:b will perform r10 sat( r2 se(r3[15:0])) >> 15 111 rx 00000 ry 31 29 28 25 24 20 19 16 00001110100y rd 15 12 11 8 7 5 4 3 0
242 32000d?04/2011 avr32 mulu.d ? multiply unsigned architecture revision: architecture revision1 and higher. description multiplies the two registers specified and stores the result in the destination registers. operation: i. rd+1:rd rx ry; syntax: i. mulu.d rd, rx, ry operands: i. d {0, 2, 4, ?, 14} {x, y} {0, 1, ?, 15} status flags q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 rx 00000 rd 31 29 28 25 24 20 19 16 000001100100 rd 15 12 11 4 3 0
243 32000d?04/2011 avr32 mulwh.d ? multiply word with halfword architecture revision: architecture revision1 and higher. description multiplies the word register with the halfword register specified and stores result in the destina- tion register pair. the halfword register is selected as either the high or low part of ry. since the most significant part of the product is stor ed, no overflow will occur. operation: i. operand1 = rx; if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); (rd+1:rd)[63:16] operand1 operand2; rd[15:0] 0; syntax: i. mulwh.d rd, rx, ry: operands: i. d {0, 2, 4, ?, 14} {x, y} {0, 1, ?, 15} part {t,b} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 00001101100y rd 15 12 11 8 7 5 4 3 0
244 32000d?04/2011 avr32 musfr ? copy regist er to status register architecture revision: architecture revision1 and higher. description the instruction copies the lower 4 bits of the register rs to the lower 4 bits of the status register. operation: i. sr[3:0] rs[3:0]; syntax: i. musfr rs operands: i. s {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 010111010011 rs 15 13 12 9 8 4 3 0
245 32000d?04/2011 avr32 mustr ? copy status register to register architecture revision: architecture revision1 and higher. description the instruction copies the value of the 4 lower bits of the status register into the register rd. the value is zero extended. operation: i. rd ze(sr[3:0]); syntax: i. mustr rd operands: i. d {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 010111010010 rd 15 13 12 9 8 4 3 0
246 32000d?04/2011 avr32 mvcr.{d,w} ? move coprocessor r egister to register file architecture revision: architecture revision1 and higher. description addresses a coprocessor and moves the specified registers into the register file. operation: i. (rd+1:rd) cp#(crs+1:crs); ii. rd cp#(crs); syntax: i. mvcr.d cp#, rd, crs ii. mvcr.w cp#, rd, crs operands: i. # {0, 1, ?, 7} {d, s} {0, 2, 4, ?, 14} ii. # {0, 1, ?, 7} {d, s} {0, 1, ?, 15} status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: format i: format ii: example: mvcr.d cp2, r0, cr2 1110 1111010 rd 0 31 29 28 25 24 20 19 17 16 cp# 0 crs 000010000 15 13 12 11 9 8 7 0 1 1110 1111010 rd 31 29 28 25 24 20 19 16 cp# 0 crs 0000000 15 13 12 11 8 7 0 1 0
247 32000d?04/2011 avr32 mvrc.{d,w} ? move register file register to coprocessor register architecture revision: architecture revision1 and higher. description moves the specified register into the addressed coprocessor. operation: i. cp#(crd+1:crd) rs+1:rs; ii. cp#(crd) rs; syntax: i. mvrc.d cp#, crd, rs ii. mvrc.w cp#, crd, rs operands: i. # {0, 1, ?, 7} {d, s} {0, 2, 4, ?, 14} i. # {0, 1, ?, 7} {d, s} {0, 1, ?, 15} status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: format i: format ii: example: mvrc.d cp2, cr0, r2 1110 1111010 rs 0 31 29 28 25 24 20 19 17 16 cp# 0 crd 000110000 15 13 12 11 9 8 7 0 1 1110 1111010 rs 31 29 28 25 24 20 19 16 cp# 0 crd 0010000 15 13 12 11 8 7 0 1 0
248 32000d?04/2011 avr32 neg ? two?s complement architecture revision: architecture revision1 and higher. description perform a two?s complement of specified register. operation: i. rd 0 -rd; syntax: i. neg rd operands: i. d {0, 1, ?, 15} status flags: q: not affected v: v rd[31] res[31] n: n res[31] z: z (res[31:0] == 0) c: c rd[31] res[31] opcode: 010111000011 rd 15 13 12 9 8 4 3 0
249 32000d?04/2011 avr32 nop ? no operation architecture revision: architecture revision1 and higher. description special instructions for "no operation" that does not create data depencencies in the pipeline operation: i. none syntax: i. nop operands: i. none status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: 110101110000001 1 15 98 43 0
250 32000d?04/2011 avr32 or ? logical or with optional logical shift architecture revision: architecture revision1 and higher. description performs a bitwise logical or between the specified registers and stores the result in the desti- nation register. operation: i. rd rd rs; ii. rd rx (ry << sa5); iii. rd rx (ry >> sa5); syntax: i. or rd, rs ii. or rd, rx, ry << sa iii. or rd, rx, ry >> sa operands: i. {d, s} {0, 1, ?, 15} ii, iii. {d, x, y} {0, 1, ?, 15} sa {0, 1, ?, 31} status flags: q: not affected. v: not affected. n: n res[31] z: z (res[31:0] == 0) c: not affected. opcode: format i: format ii: 000 rs 00100 rd 15 13 12 9 8 4 3 0 111 rx 11110 ry 31 29 28 25 24 20 19 16 0001000 sa5 rd 15 9 8 4 3 0
251 32000d?04/2011 avr32 format iii: 111 rx 11110 ry 31 29 28 25 24 20 19 16 0001001 sa5 rd 15 9 8 4 3 0
252 32000d?04/2011 avr32 or{cond4} ? conditi onal logical or architecture revision: architecture revision 2 and higher. description performs a bitwise logical or between the specified registers and stores the result in the desti- nation register. operation: i. if ( cond4) rd rx ry; syntax: i. or{cond4} rd, rx, ry operands: i. {d, x, y} {0, 1, ?, 15} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 11101 ry 31 29 28 25 24 20 19 16 1110 cond4 0011 rd 15 12 11 8 7 0 rx
253 32000d?04/2011 avr32 orh, orl ? logical or into hi gh or low half of register architecture revision: architecture revision1 and higher. description performs a bitwise logical or between the high or low word in the specified register and a con- stant. the result is stored in the destination register. operation: i. rd[31:16] rd[31:16] imm16; ii. rd[15:0] rd[15:0] imm16; syntax: i. orh rd, imm ii. orl rd, imm operands: i, ii. d {0, 1, ?, 15} imm {0, 1, ..., 65535} status flags: q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: not affected opcode format i: format ii: 1110 0100001 rd 31 29 28 20 19 16 imm16 15 0 1 1110 0000001 rd 31 29 28 20 19 16 imm16 15 0 1
254 32000d?04/2011 avr32 pabs.{sb/sh} ? pac ked absolute value architecture revision: architecture revision1 and higher. description compute the absolute values of four packed signed bytes (pabs.sb) or two packed signed half- words (pabs.sh) from the source register and store the results as packed bytes or halfwords in the destination register. operation: i. rd[31:24] | rs[31:24] |; rd[23:16] | rs[23:16] |; rd[15:8] | rs[15:8] |; rd[7:0] | rs[7:0] |; ii. rd[31:16] | rs[31:16] |; rd[15:0] | rs[15:0] |; syntax: i. pabs.sb rd, rs ii. pabs.sh rd, rs operands: i, ii. {d, s} {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: 1110 00000 rs 31 20 19 16 0010001111 10 rd 15 4 3 0 0 0 0 1110 00000 rs 31 20 19 16 0010001111 11 rd 15 4 3 0 0 0 0
255 32000d?04/2011 avr32 packsh.{ub/sb} ? pack si gned halfwords to bytes architecture revision: architecture revision1 and higher. description pack the four signed halfwords located in the two source registers into four bytes in the destina- tion register. each of the signed halfwords are saturated to unsigned (packsh.ub) or signed bytes (packsh.sb). operation: i. rd[31:24] satsu(rx[31:16], 8); rd[23:16] satsu(rx[15:0], 8); rd[15:8] satsu(ry[31:16], 8); rd[7:0] satsu(ry[15:0], 8); ii. rd[31:24] sats(rx[31:16], 8); rd[23:16] sats(rx[15:0], 8); rd[15:8] sats(ry[31:16], 8); rd[7:0] sats(ry[15:0], 8); syntax: i. packsh.ub rd, rx, ry ii. packsh.sb rd, rx, ry operands: i, ii. {d, x, y} {0, 1, ?, 15} status flags: q: flag set if saturation occured in one or more of the partial operations. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: 111 00000 ry 31 29 28 25 24 20 19 16 0010010011 00 rd 15 4 3 0 rx 111 00000 ry 31 29 28 25 24 20 19 16 0010010011 01 rd 15 4 3 0 rx
256 32000d?04/2011 avr32
257 32000d?04/2011 avr32 packw.sh ? pack words to signed halfwords architecture revision: architecture revision1 and higher. description pack the two words given in the source registers into two halfwords in the destination register. each of the words are saturated to signed halfwords before being packed. operation: i. rd[31:16] sats(rx, 16); rd[15:0] sats(ry, 16); syntax: i. packw.sh rd, rx, ry operands: i. {d, x, y} {0, 1, ?, 15} status flags: q: flag set if saturation occured in one or more of the partial operations. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010010001 11 rd 15 4 3 0 rx
258 32000d?04/2011 avr32 padd.{b/h} ? packed addition architecture revision: architecture revision1 and higher. description perform addition of four pairs of packed bytes (padd.b) or two pairs of halfwords (padd.h). upon overflow any additional bits are discarded and the result is wrapped around. operation: i. rd[31:24] rx[31:24] + ry[31:24]; rd[23:16] rx[23:16] + ry[23:16]; rd[15:8] rx[15:8] + ry[15:8]; rd[7:0] rx[7:0] + ry[7:0]; ii. rd[31:16] rx[31:16] + ry[31:16]; rd[15:0] rx[15:0] + ry[15:0]; syntax: i. padd.b rd, rx, ry ii. padd.h rd, rx, ry operands: i, ii. {d, x, y} {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: 111 00000 ry 31 29 28 25 24 20 19 16 0010001100 00 rd 15 4 3 0 rx 111 00000 ry 31 29 28 25 24 20 19 16 0010000000 00 rd 15 4 3 0 rx
259 32000d?04/2011 avr32 paddh.{ub/sh} ? packed addition with halving architecture revision: architecture revision1 and higher. description perform addition of four pairs of packed unsigned bytes (paddh.ub) or two pairs of packed signed halfwords (paddh.sh) with a halving of the result to prevent any overflows from occuring. operation: i. rd[31:24] lsr(ze(rx[31:24], 9) + ze(ry[31:24], 9), 1) ; rd[23:16] lsr(ze(rx[23:16], 9) + ze(ry[23:16], 9), 1); rd[15:8] lsr(ze(rx[15:8], 9) + ze(ry[15:8], 9), 1); rd[7:0] lsr(ze(rx[7:0], 9) + ze(ry[7:0], 9), 1); ii. rd[31:16] asr(se(rx[31:16], 17) + se(ry[31:16], 17), 1); rd[15:0] asr(se(rx[15:0], 17) + se(ry[15:0], 17), 1); syntax: i. paddh.ub rd, rx, ry ii. paddh.sh rd, rx, ry operands: i, ii. {d, x, y} {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: 111 00000 ry 31 29 28 25 24 20 19 16 0010001101 10 rd 15 4 3 0 rx 111 00000 ry 31 29 28 25 24 20 19 16 0010000011 00 rd 15 4 3 0 rx
260 32000d?04/2011 avr32 padds.{ub/sb/uh/sh} ? packed addition with saturation architecture revision: architecture revision1 and higher. description perform addition of four pairs of packed bytes or two pairs of halfwords. the result is saturated to either unsigned bytes (padds.ub), signed bytes (padds.sb), unsigned halfwords (padds.uh) or signed halfwords (padds.sh). operation: i. rd[31:24] satu(ze(rx[31:24], 9) + ze(ry[31:24], 9), 8) ; rd[23:16] satu(ze(rx[23:16], 9) + ze(ry[23:16], 9), 8); rd[15:8] satu(ze(rx[15:8], 9) + ze(ry[15:8], 9), 8); rd[7:0] satu(ze(rx[7:0], 9) + ze(ry[7:0], 9), 8); ii. rd[31:24] sats(se(rx[31:24], 9) + se(ry[31:24], 9), 8); rd[23:16] sats(se(rx[23:16], 9) + se(ry[23:16], 9), 8); rd[15:8] sats(se(rx[15:8], 9) + se(ry[15:8], 9), 8); rd[7:0] sats(se(rx[7:0], 9) + se(ry[7:0], 9), 8); iii. rd[31:16] satu(ze(rx[31:16], 17) + ze(ry[31:16], 17), 16); rd[15:0] satu(ze(rx[15:0], 17) + ze(ry[15:0], 17), 16); iv. rd[31:16] sats(se(rx[31:16], 17) + se(ry[31:16], 17), 16); rd[15:0] sats(se(rx[15:0], 17) + se(ry[15:0], 17), 16); syntax: i. padds.ub rd, rx, ry ii. padds.sb rd, rx, ry iii. padds.uh rd, rx, ry iv. padds.sh rd, rx, ry operands: i, ii, iii, iv.{d, x, y} {0, 1, ?, 15} status flags: q: flag set if saturation occured in one or more of the partial operations. v: not affected. n: not affected. z: not affected. c: not affected. opcode:
261 32000d?04/2011 avr32 format i: format ii: format iii: format iv: 111 00000 ry 31 29 28 25 24 20 19 16 0010001101 00 rd 15 4 3 0 rx 111 00000 ry 31 29 28 25 24 20 19 16 0010001100 10 rd 15 4 3 0 rx 111 00000 ry 31 29 28 25 24 20 19 16 0010000010 00 rd 15 4 3 0 rx 111 00000 ry 31 29 28 25 24 20 19 16 0010000001 00 rd 15 4 3 0 rx
262 32000d?04/2011 avr32 paddsub.h ? packed halfword addition and subtraction architecture revision: architecture revision1 and higher. description perform an addition and subtraction on the same halfword operands which are selected from the source registers. the two halfword results are packed into the destination register without per- forming any saturation. operation: i. if (rx-part == t) then operand1 = rx[31:16] else operand1 = rx[15:0]; if (ry-part == t) then operand2 = ry[31:16] else operand2 = ry[15:0]; rd[31:16] operand1 + operand2; rd[15:0] operand1 - operand2; syntax: i. paddsub.h rd, rx:, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010000100 xy rd 15 6543 0 rx
263 32000d?04/2011 avr32 paddsubh.sh ? packed halfword addi tion and subtraction with halving description perform an addition and subtraction on the same signed halfword operands which are selected from the source registers. the halfword results are halved in order to prevent any overflows from occuring operation: i. if (rx-part == t) then operand1 = rx[31:16] else operand1 = rx[15:0]; if (ry-part == t) then operand2 = ry[31:16] else operand2 = ry[15:0]; rd[31:16] asr(se(operand1, 17) + se(operand2, 17), 1); rd[15:0] asr(se(operand1, 17) - se(operand2, 17), 1); syntax: i. paddsubh.sh rd, rx:, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010001010 xy rd 15 6543 0 rx
264 32000d?04/2011 avr32 paddsubs.{uh/sh} ? packed halfword addition and subtraction with sat- uration architecture revision: architecture revision1 and higher. description perform an addition and subtraction on the same halfword operands which are selected from the source registers. the resulting halfwords are saturated to unsigned halfwords (paddsubs.uh) or signed halfwords (paddsubs.sh) and then packed together in the destination register. operation: i. if (rx-part == t) then operand1 = rx[31:16] else operand1 = rx[15:0]; if (ry-part == t) then operand2 = ry[31:16] else operand2 = ry[15:0]; rd[31:16] satu(ze(operand1, 17) + ze(operand2, 17), 16); rd[15:0] satsu(ze(operand1, 17) - ze(operand2, 17), 16); ii. if (rx-part == t) then operand1 = rx[31:16] else operand1 = rx[15:0]; if (ry-part == t) then operand2 = ry[31:16] else operand2 = ry[15:0]; rd[31:16] sats(se(operand1, 17) + se(operand2, 17), 16); rd[15:0] sats(se(operand1, 17) - se(operand2, 17), 16); syntax: i. paddsubs.uh rd, rx:, ry: ii. paddsubs.sh rd, rx:, ry: operands: i,ii. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: flag set if saturation occured in one or more of the partial operations. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010001000 xy rd 15 6543 0 rx
265 32000d?04/2011 avr32 format ii: 111 00000 ry 31 29 28 25 24 20 19 16 0010000110 xy rd 15 6543 0 rx
266 32000d?04/2011 avr32 paddx.h ? packed halfword ad dition with crossed operand architecture revision: architecture revision1 and higher. description add together the top halfword of rx with the bottom halfword of ry and the bottom halfword of rx with the top halfword of ry. the resulting halfwords are packed together in the destination register without performing any saturation. operation: i. rd[31:16] rx[31:16] + ry[15:0] ; rd[15:0] rx[15:0] + ry[31:16]; syntax: i. paddx.h rd, rx, ry operands: i. {d, x, y} {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010000000 10 rd rx 15 4 3 0
267 32000d?04/2011 avr32 paddxh.sh ? packed signed halfword addition with crossed operand and halving architecture revision: architecture revision1 and higher. description add together the top halfword of rx with the bottom halfword of ry and the bottom halfword of rx with the top halfword of ry. the resulting halfwords are halved in order to avoid any overflow and then packed together in the destination register. operation: i. rd[31:16] asr(se(rx[31:16], 17) + se(ry[15:0], 17), 1); rd[15:0] asr(se(rx[15:0], 17) + se(ry[31:16], 17), 1); syntax: i. paddxh.sh rd, rx, ry operands: i. {d, x, y} {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010000011 10 rd 15 4 3 0 rx
268 32000d?04/2011 avr32 paddxs.{uh/sh} ? packed halfword addition with crossed operand and saturation architecture revision: architecture revision1 and higher. description add together the top halfword of rx with the bottom halfword of ry and the bottom halfword of rx with the top halfword of ry. the resulting halfwords are saturated to unsigned halfwords (paddxh.uh) or signed halfwords (paddxh.sh) and then packed together in the destination regis- ter. operation: i. rd[31:16] satu(ze(rx[31:16], 17) + ze(ry[15:0], 17), 16) ; rd[15:0] satu(ze(rx[15:0], 17) + ze(ry[31:16], 17), 16); ii. rd[31:16] sats(se(rx[31:16], 17) + se(ry[15:0], 17), 16) ; rd[15:0] sats(se(rx[15:0], 17) + se(ry[31:16], 17), 16); syntax: i. paddxs.uh rd, rx, ry ii. paddxs.sh rd, rx, ry operands: i, ii. {d, x, y} {0, 1, ?, 15} status flags: q: flag set if saturation occured in one or more of the partial operations. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: 111 00000 ry 31 29 28 25 24 20 19 16 0010000010 10 rd 15 4 3 0 rx 111 00000 ry 31 29 28 25 24 20 19 16 0010000001 10 rd 15 4 3 0 rx
269 32000d?04/2011 avr32 pasr.{b/h} ? packed arithmetic shift right architecture revision: architecture revision1 and higher. description perform an arithmetic shift right on each of the packed bytes or halfwords in the source register. operation: i. rd[31:24] asr(rs[31:24], sa3); rd[23:16] asr(rs[23:16], sa3); rd[15:8] asr(rs[15:8], sa3); rd[7:0] asr(rs[7:0], sa3); ii. rd[31:16] asr(rs[31:16], sa4); rd[15:0] asr(rs[15:0], sa4); syntax: i. pasr.b rd, rs, sa ii. pasr.h rd, rs, sa operands: i, ii. {d, s} {0, 1, ?, 15} i. sa {0, 1, ?, 7} ii. sa {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 000000 sa3 31 29 28 25 24 19 18 16 0010010000 01 rd 15 4 3 0 rs
270 32000d?04/2011 avr32 format ii: 111 00000 sa4 31 29 28 25 24 20 19 16 0010010001 00 rd 15 4 3 0 rs
271 32000d?04/2011 avr32 pavg.{ub/sh} ? packed average architecture revision: architecture revision1 and higher. description computes the average of pairs of packed unsigned bytes (pavg.ub) or packed signed halfwords (pavg.sh). the averages are computed by adding two values together while also adding in a rounding factor in the least significant bit. the result is then halved by shifting it one position to the right. operation: i. rd[31:24] lsr(ze(rx[31:24], 9) + ze(ry[31:24], 9) + 1, 1); rd[23:16] lsr(ze(rx[23:16], 9) + ze(ry[23:16], 9) + 1, 1); rd[15:8] lsr(ze(rx[15:8], 9) + ze(ry[15:8], 9) + 1, 1); rd[7:0] lsr(ze(rx[7:0], 9) + ze(ry[7:0], 9) + 1, 1); ii. rd[31:16] asr(se(rx[31:16], 17) + se(ry[31:16], 17) + 1, 1); rd[15:0] asr(se(rx[15:0], 17) + se(ry[15:0], 17) + 1, 1); syntax: i. pavg.ub rd, rx, ry ii. pavg.sh rd, rx, ry operands: i, ii. {d, x, y} {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010001111 00 rd 15 4 3 0 rx
272 32000d?04/2011 avr32 format ii: 111 00000 ry 31 29 28 25 24 20 19 16 0010001111 01 rd 15 4 3 0 rx
273 32000d?04/2011 avr32 plsl.{b/h} ? packed logical shift left architecture revision: architecture revision1 and higher. description perform a logical shift left on each of the packed bytes or halfwords in the source register and store the result to the destination register. operation: i. rd[31:24] lsl(rs[31:24], sa3); rd[23:16] lsl(rs[23:16], sa3); rd[15:8] lsl(rs[15:8], sa3); rd[7:0] lsl(rs[7:0], sa3); ii. rd[31:16] lsl(rs[31:16], sa4); rd[15:0] lsl(rs[15:0], sa4); syntax: i. plsl.b rd, rs, sa ii. plsl.h rd, rs, sa operands: i, ii. {d, s} {0, 1, ?, 15} i. sa {0, 1, ?, 7} ii. sa {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 000000 sa3 31 29 28 25 24 19 18 16 0010010000 10 rd 15 4 3 0 rs
274 32000d?04/2011 avr32 format ii: 111 00000 sa4 31 29 28 25 24 20 19 16 0010010001 01 rd 15 4 3 0 rs
275 32000d?04/2011 avr32 plsr.{b/h} ? packed logical shift right architecture revision: architecture revision1 and higher. description perform a logical shift right on each of the packed bytes or halfwords in the source register and store the result to the destination register. operation: i. rd[31:24] lsr(rs[31:24], sa3); rd[23:16] lsr(rs[23:16], sa3); rd[15:8] lsr(rs[15:8], sa3); rd[7:0] lsr(rs[7:0], sa3); ii. rd[31:16] lsr(rs[31:16], sa4); rd[15:0] lsr(rs[15:0], sa4); syntax: i. plsr.b rd, rs, sa ii. plsr.h rd, rs, sa operands: i, ii. {d, s} {0, 1, ?, 15} i. sa {0, 1, ?, 7} ii. sa {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 000000 sa3 31 29 28 25 24 19 18 16 0010010000 11 rd 15 4 3 0 rs
276 32000d?04/2011 avr32 format ii: 111 00000 sa4 31 29 28 25 24 20 19 16 0010010001 10 rd 15 4 3 0 rs
277 32000d?04/2011 avr32 pmax.{ub/sh} ? pack ed maximum value architecture revision: architecture revision1 and higher. description compute the maximum values of pairs of packed unsigned bytes (pmax.ub) or packed signed halfwords (pmax.sh). operation: i. if ( rx[31:24] > ry[31:24] ) then rd[31:24] rx[31:24] else rd[31:24] ry[31:24] ; if ( rx[23:16] > ry[23:16] ) then rd[23:16] rx[23:16] else rd[23:16] ry[23:16] ; if ( rx[15:8] > ry[15:8] ) then rd[15:8] rx[15:8] else rd[15:8] ry[15:8] ; if ( rx[7:0] > ry[7:0] ) then rd[7:0] rx[7:0] else rd[7:0] ry[7:0] ; ii. if ( rx[31:16] > ry[31:16] ) then rd[31:16] rx[31:16] else rd[31:16] ry[31:16] ; if ( rx[15:0] > ry[15:0] ) then rd[15:0] rx[15:0] else rd[15:0] ry[15:0] ; syntax: i. pmax.ub rd, rx, ry ii. pmax.sh rd, rx, ry operands: i, ii. {d, x, y} {0, 1, ?, 15} status flags: format i: q: not affected. v: ( rx[7:0] > ry[7:0] ) n: ( rx[15:8] > ry[15:8] ) z: ( rx[23:16] > ry[23:16] ) c: ( rx[31:24] > ry[31:24] ) format ii: q: not affected. v: not affected. n: not affected. z: ( rx[15:0] > ry[15:0] ) c: ( rx[31:16] > ry[31:16] ) opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010001110 00 rd 15 4 3 0 rx
278 32000d?04/2011 avr32 format ii: 111 00000 ry 31 29 28 25 24 20 19 16 0010001110 01 rd 15 4 3 0 rx
279 32000d?04/2011 avr32 pmin.{ub/sh} ? pa cked minimum value architecture revision: architecture revision1 and higher. description compute the minimum values of pairs of packed unsigned bytes (pmin.ub) or packed signed halfwords (pmin.sh). operation: i. if ( rx[31:24] < ry[31:24] ) then rd[31:24] rx[31:24] else rd[31:24] ry[31:24] ; if ( rx[23:16] < ry[23:16] ) then rd[23:16] rx[23:16] else rd[23:16] ry[23:16] ; if ( rx[15:8] < ry[15:8] ) then rd[15:8] rx[15:8] else rd[15:8] ry[15:8] ; if ( rx[7:0] < ry[7:0] ) then rd[7:0] rx[7:0] else rd[7:0] ry[7:0] ; ii. if ( rx[31:16] < ry[31:16] ) then rd[31:16] rx[31:16] else rd[31:16] ry[31:16] ; if ( rx[15:0] < ry[15:0] ) then rd[15:0] rx[15:0] else rd[15:0] ry[15:0] ; syntax: i. pmin.ub rd, rx, ry ii. pmin.sh rd, rx, ry operands: i, ii. {d, x, y} {0, 1, ?, 15} status flags: format i: q: not affected. v: ( rx[7:0] < ry[7:0] ) n: ( rx[15:8] < ry[15:8] ) z: ( rx[23:16] < ry[23:16] ) c: ( rx[31:24] < ry[31:24] ) format ii: q: not affected. v: not affected. n: not affected. z: ( rx[15:0] < ry[15:0] ) c: ( rx[31:16] < ry[31:16] ) opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010001110 10 rd 15 4 3 0 rx
280 32000d?04/2011 avr32 format ii: 111 00000 ry 31 29 28 25 24 20 19 16 0010001110 11 rd 15 4 3 0 rx
281 32000d?04/2011 avr32 popjc ? pop java context from frame architecture revision: architecture revision1 and higher. description fetch the system registers lv0 to lv7 used in java state from the current method frame. the register frame (equal to r9) is used as pointer register. operation: i. temp frame; java_lv0 *(temp--); java_lv1 *(temp--); java_lv2 *(temp--); java_lv3 *(temp--); java_lv4 *(temp--); java_lv5 *(temp--); java_lv6 *(temp--); java_lv7 *(temp--); syntax: i. popjc operands: i. none status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 110101110001001 1 15 98 43 0
282 32000d?04/2011 avr32 popm ? pop multiple registers from stack architecture revision: architecture revision1 and higher. description loads the consecutive words pointed to by sp into the registers specified in the instruction. the pc can be loaded, resulting in a jump to the loaded value. if pc is popped, the return value in r12 is tested and the flags are updated. r12 can optionally be updated with -1, 0 or 1. the k bit in the instruction coding is used to optionally let the popm instruction update the return register r12 with the values -1, 0 or 1. operation: i. if reglist8[pc] k == b?1 pc *(sp++) if reglist8[lr:r12] == b?00 r12 0; else if reglist8[lr:r12] == b?01 r12 1; else r12 ?1; test r12 and update flags; else if reglist8[pc] == 1 then pc *(sp++); if reglist8[lr] == 1 then lr *(sp++); if reglist8[r12] == 1 then r12 *(sp++); if reglist8[pc] == 1 then test r12 and update flags; if reglist8[5] == 1 then r11 *(sp++); if reglist8[4] == 1 then r10 *(sp++); if reglist8[3] == 1 then r9 *(sp++); r8 *(sp++); if reglist8[2] == 1 then r7 *(sp++); r6 *(sp++); r5 *(sp++); r4 *(sp++); if reglist8[1] == 1 then r3 *(sp++);
283 32000d?04/2011 avr32 r2 *(sp++); r1 *(sp++); r0 *(sp++); syntax: i. popm reglist8 {, r12 = {-1, 0, 1}} if the optional r12 = {-1, 0, 1} parameter is specified, pc must be in reglist8. if the optional r12 = {-1, 0, 1} parameter is specified, lr should not be in reglist8. operands: i. reglist8 {r0- r3, r4-r7, r8-r9, r10,r11, r12, lr, pc} status flags: flags are only updated if reglist8[pc] == 1. they are set as the result of the operation cp r12, 0 q: not affected v: v 0 n: n res[31] z: z (res[31:0] == 0) c: c 0 opcode: note: emtpy reglist8 gives undefined result. the r bit in the status register has no effect on this instruction. 1101pclr1211109-87-43-0k 01 0 15 3 2 0
284 32000d?04/2011 avr32 pref ? cache prefetch architecture revision: architecture revision1 and higher. description this instruction allows the programmer to explicitly state that the cache should prefetch the specified line. the memory system treats this instruction in an implementation-dependent man- ner, and implementations without cache treats the instruction as a nop. a prefetch instruction never reduces the performance of the system. if the prefetch instruction performs an action that would lower the system performance, it is treated as a nop. for example, if the prefetch instruc- tion is about to generate an addressing exception, the instruction is cancelled and no exception is taken. operation: i. prefetch cache line containing the address (rp + se(disp16)). syntax: pref rp[disp] operands: i. p {0, 1, ?, 15} disp {-32768, -32767, ..., 32767} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 1111 0100001 rp 31 29 28 20 19 16 disp16 15 0 0
285 32000d?04/2011 avr32 psad ? packed sum of absolute differences architecture revision: architecture revision1 and higher. description compute the sum of absolute differences (sad) of four pairs of packed unsigned bytes from the source registers and store the result in the destination register. operation: i. rd | rx[31:24] - ry[31:24] | + | rx[23:16] - ry[23:16] | + | rx[15:8] - ry[15:8] | + | rx[7:0] - ry[7:0] |; syntax: i. psad rd, rx, ry operands: i, ii. {d, x, y} {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010010000 00 rd 15 4 3 0 rx
286 32000d?04/2011 avr32 psub.{b/h} ? packed subtraction architecture revision: architecture revision1 and higher. description perform subtraction of four pairs of packed bytes (psub.b) or two pairs of halfwords (psub.h). upon overflow any additional bits are discarded and the result is wrapped around. operation: i. rd[31:24] rx[31:24] - ry[31:24]; rd[23:16] rx[23:16] - ry[23:16]; rd[15:8] rx[15:8] - ry[15:8]; rd[7:0] rx[7:0] - ry[7:0]; ii. rd[31:16] rx[31:16] - ry[31:16]; rd[15:0] rx[15:0] - ry[15:0]; syntax: i. psub.b rd, rx, ry ii. psub.h rd, rx, ry operands: i, ii. {d, x, y} {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: 111 00000 ry 31 29 28 25 24 20 19 16 0010001100 01 rd 15 4 3 0 rx 111 00000 ry 31 29 28 25 24 20 19 16 0010000000 01 rd 15 4 3 0 rx
287 32000d?04/2011 avr32 psubadd.h ? packed halfwo rd subtraction and addition architecture revision: architecture revision1 and higher. description perform an subtraction and addition on the same halfword operands which are selected from the source registers. the two halfword results are packed into the destination register without per- forming any saturation. operation: i. if (rx-part == t) then operand1 = rx[31:16] else operand1 = rx[15:0]; if (ry-part == t) then operand2 = ry[31:16] else operand2 = ry[15:0]; rd[31:16] operand1 - operand2; rd[15:0] operand1 + operand2; syntax: i. psubadd.h rd, rx:, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010000101 xy rd 15 6543 0 rx
288 32000d?04/2011 avr32 psubaddh.sh ? packed si gned halfword subtraction and addition with halving architecture revision: architecture revision1 and higher. description perform a subtraction and addition on the same halfword operands which are selected from the source registers. the halfword results are halved in order to prevent any overflows from occuring operation: i. if (rx-part == t) then operand1 = rx[31:16] else operand1 = rx[15:0]; if (ry-part == t) then operand2 = ry[31:16] else operand2 = ry[15:0]; rd[31:16] asr(se(operand1, 17) - se(operand2, 17), 1); rd[15:0] asr(se(operand1, 17) + se(operand2, 17), 1); syntax: i. psubaddh.sh rd, rx:, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010001011 xy rd 15 6543 0 rx
289 32000d?04/2011 avr32 psubadds.{uh/sh} ? packed halfword subtrac tion and addition with saturation architecture revision: architecture revision1 and higher. description perform a subtraction and addition on the same halfword operands which are selected from the source registers. the resulting halfwords are saturated to unsigned halfwords (psubadds.uh) or signed halfwords (psubadds.sh) and then packed together in the destination register. operation: i. if (rx-part == t) then operand1 = rx[31:16] else operand1 = rx[15:0]; if (ry-part == t) then operand2 = ry[31:16] else operand2 = ry[15:0]; rd[31:16] satsu(ze(operand1, 17) - ze(operand2, 17), 16); rd[15:0] satu(ze(operand1, 17) + ze(operand2, 17), 16); ii. if (rx-part == t) then operand1 = rx[31:16] else operand1 = rx[15:0]; if (ry-part == t) then operand2 = ry[31:16] else operand2 = ry[15:0]; rd[31:16] sats(se(operand1, 17) - se(operand2, 17), 16 ); rd[15:0] sats(se(operand1, 17) + se(operand2, 17), 16); syntax: i. psubadds.uh rd, rx:, ry: ii. psubadds.sh rd, rx:, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: q: flag set if saturation occured in one or more of the partial operations. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010001001 xy rd 15 6543 0 rx
290 32000d?04/2011 avr32 format ii: 111 00000 ry 31 29 28 25 24 20 19 16 0010000111 xy rd 15 6543 0 rx
291 32000d?04/2011 avr32 psubh.{ub/sh} ? packed subtracti on with halving architecture revision: architecture revision1 and higher. description perform subtraction of four pairs of packed unsigned bytes (psub.ub) or two pairs of signed half- words (psub.sh) with a halfing of the result to prevent any overflows from occuring. operation: i. rd[31:24] lsr(ze(rx[31:24], 9) - ze(ry[31:24], 9), 1); rd[23:16] lsr(ze(rx[23:16], 9) - ze(ry[23:16], 9), 1); rd[15:8] lsr(ze(rx[15:8], 9) - ze(ry[15:8], 9), 1); rd[7:0] lsr(ze(rx[7:0], 9) - ze(ry[7:0], 9), 1); ii. rd[31:16] asr(se(rx[31:16], 17) - se(ry[31:16], 17), 1); rd[15:0] asr(se(rx[15:0], 17) - se(ry[15:0], 17), 1); syntax: i. psubh.ub rd, rx, ry ii. psubh.sh rd, rx, ry operands: i, ii. {d, x, y} {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: 111 00000 ry 31 29 28 25 24 20 19 16 0010001101 11 rd 15 4 3 0 rx 111 00000 ry 31 29 28 25 24 20 19 16 0010000011 01 rd 15 4 3 0 rx
292 32000d?04/2011 avr32 psubs.{ub/sb/uh/sh} ? packed subtraction with saturation architecture revision: architecture revision1 and higher. description perform subtraction of four pairs of packed bytes or two pairs of halfwords. the result is satu- rated to either unsigned bytes (psubs.ub), signed bytes (psubs.sb), unsigned halfwords (psubs.uh) or signed halfwords (psubs.sh). operation: i. rd[31:24] satsu(ze(rx[31:24], 9) - ze(ry[31:24], 9), 8) ; rd[23:16] satsu(ze(rx[23:16], 9) - ze(ry[23:16], 9), 8); rd[15:8] satsu(ze(rx[15:8], 9) - ze(ry[15:8], 9), 8); rd[7:0] satsu(ze(rx[7:0], 9) - ze(ry[7:0], 9), 8); ii. rd[31:24] sats(se(rx[31:24], 9) - se(ry[31:24], 9), 8); rd[23:16] sats(se(rx[23:16], 9) - se(ry[23:16], 9), 8); rd[15:8] sats(se(rx[15:8], 9) - se(ry[15:8], 9), 8); rd[7:0] sats(se(rx[7:0], 9) - se(ry[7:0], 9), 8); iii. rd[31:16] satsu(ze(rx[31:16], 17) - ze(ry[31:16], 17), 16); rd[15:0] satsu(ze(rx[15:0], 17) - ze(ry[15:0], 17), 16); iv. rd[31:16] sats(se(rx[31:16], 17) - se(ry[31:16], 17), 16); rd[15:0] sats(se(rx[15:0], 17) - se(ry[15:0], 17), 16); syntax: i. psubs.ub rd, rx, ry ii. psubs.sb rd, rx, ry iii. psubs.uh rd, rx, ry iv. psubs.sh rd, rx, ry operands: i, ii, iii, iv.{d, x, y} {0, 1, ?, 15} status flags: q: flag set if saturation occured in one or more of the partial operations. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010001101 01 rd 15 4 3 0 rx
293 32000d?04/2011 avr32 format ii: format iii: format iv: 111 00000 ry 31 29 28 25 24 20 19 16 0010001100 11 rd 15 4 3 0 rx 111 00000 ry 31 29 28 25 24 20 19 16 0010000010 01 rd 15 4 3 0 rx 111 00000 ry 31 29 28 25 24 20 19 16 0010000001 01 rd 15 4 3 0 rx
294 32000d?04/2011 avr32 psubx.h ? packed halfword s ubtraction with crossed operand architecture revision: architecture revision1 and higher. description subtract the bottom halfword of ry from the top halfword of rx and the top halfword of ry from the bottom halfword of rx. the resulting halfwords are packed together in the destination regis- ter without performing any saturation. operation: i. rd[31:16] rx[31:16] - ry[15:0] ; rd[15:0] rx[15:0] - ry[31:16]; syntax: i. psubx.h rd, rx, ry operands: i. {d, x, y} {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010000000 11 rd 15 4 3 0 rx
295 32000d?04/2011 avr32 psubxh.sh ? packed signed halfword subtraction with crossed operand and halving architecture revision: architecture revision1 and higher. description subtract the bottom halfword of ry from the top halfword of rx and the top halfword of ry from the bottom halfword of rx. the resulting halfwords are halved in order to avoid any overflow and then packed together in the destination register. operation: i. rd[31:16] asr(se(rx[31:16], 17) - se(ry[15:0], 17), 1); rd[15:0] asr(se(rx[15:0], 17) - se(ry[31:16], 17), 1); syntax: i. psubxh.sh rd, rx, ry operands: i. {d, x, y} {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 00000 ry 31 29 28 25 24 20 19 16 0010000011 11 rd 15 4 3 0 rx
296 32000d?04/2011 avr32 psubxs.{uh/sh} ? packed halfword subtraction with crossed operand and saturation architecture revision: architecture revision1 and higher. description subtract the bottom halfword of ry from the top halfword of rx and the top halfword of ry from the bottom halfword of rx. the resulting halfwords are saturated to unsigned halfwords (psubxh.uh) or signed halfwords (psubxh.sh) and then packed together in the destination regis- ter. operation: i. rd[31:16] satsu(ze(rx[31:16], 17) - ze(ry[15:0], 17), 16) ; rd[15:0] satsu(ze(rx[15:0], 17) - ze(ry[31:16], 17), 16); ii. rd[31:16] sats(se(rx[31:16], 17) - se(ry[15:0], 17), 16) ; rd[15:0] sats(se(rx[15:0], 17) - se(ry[31:16], 17), 16); syntax: i. psubxs.uh rd, rx, ry ii. psubxs.sh rd, rx, ry operands: i, ii. {d, x, y} {0, 1, ?, 15} status flags: q: flag set if saturation occured in one or more of the partial operations. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: 111 00000 ry 31 29 28 25 24 20 19 16 0010000010 11 rd 15 4 3 0 rx 111 00000 ry 31 29 28 25 24 20 19 16 0010000001 11 rd 15 4 3 0 rx
297 32000d?04/2011 avr32
298 32000d?04/2011 avr32 punpck{sb/ub}.h ? unpac k bytes to halfwords architecture revision: architecture revision1 and higher. description unpack two unsigned bytes (punpckub.h) or two signed bytes (punpcksb.h) from the source reg- ister to two packed halfwords in the destination register. operation: i. if ( rs-part == top ) then rd[31:16] ze(rs[31:24], 16); rd[15:0] ze(rs[23:16], 16); else rd[31:16] ze(rs[15:8], 16); rd[15:0] ze(rs[7:0], 16); ii. if ( rs-part == top ) then rd[31:16] se(rs[31:24], 16); rd[15:0] se(rs[23:16], 16); else rd[31:16] se(rs[15:8], 16); rd[15:0] se(rs[7:0], 16); syntax: i. punpckub.h rd, rs: ii. punpcksb.h rd, rs: operands: i, ii. {d, s} {0, 1, ?, 15} part {t, b} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 000000 0 0 31 29 28 25 24 16 0010010010 0k rd 15 5 4 3 0 rs 0
299 32000d?04/2011 avr32 format ii: 111 000000 0 0 31 29 28 25 24 16 0010010010 1k rd 15 5 4 3 0 rs 0
300 32000d?04/2011 avr32 pushjc ? push java context to frame architecture revision: architecture revision1 and higher. description stores the system registers lv0 to lv7 used in java state to designated place on the current method frame. frame (equal to r9) is used as pointer register. operation: i. temp frame; *(temp--) java_lv0; *(temp--) java_lv1; *(temp--) java_lv2; *(temp--) java_lv3; *(temp--) java_lv4; *(temp--) java_lv5; *(temp--) java_lv6; *(temp--) java_lv7; syntax: i. pushjc operands: i. none status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 1101011100100011 15 98 43 0
301 32000d?04/2011 avr32 pushm ? push multiple registers to stack architecture revision: architecture revision1 and higher. description stores the registers specified in the instruction into consecutive words pointed to by sp. operation: i. if reglist8[0] == 1 then *(--sp) r0; *(--sp) r1; *(--sp) r2; *(--sp) r3; if reglist8[1] == 1 then *(--sp) r4; *(--sp) r5; *(--sp) r6; *(--sp) r7; if reglist8[2] == 1 then *(--sp) r8; *(--sp) r9; if reglist8[3] == 1 then *(--sp) r10; if reglist8[4] == 1 then *(--sp) r11; if reglist8[5] == 1 then *(--sp) r12; if reglist8[6] == 1 then *(--sp) lr; if reglist8[7] == 1 then *(--sp) pc; syntax: i. pushm reglist8 operands: i. reglist8 {r0- r3, r4-r7, r8-r9, r10,r11, r12, lr, pc} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected.
302 32000d?04/2011 avr32 opcode: note: emtpy reglist8 gives undefined result. the r bit in the status register has no effect on this instruction. 1101pclr1211109-87-43-0000 1 15 13 12 11 4 3 0
303 32000d?04/2011 avr32 rcall ? relative subroutine call architecture revision: architecture revision1 and higher. description pc-relative call of subroutine operation: i. lr pc + 2 pc pc + (se(disp10)<<1) ii. lr pc + 4 pc pc + (se(disp21)<<1) syntax: i. rcall pc[disp] ii. rcall pc[disp] operands: i. disp {-1024, -1022, ..., 1022} ii. disp {-2097152, -2097150, ..., 2097150} status flags q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: 1100 disp10[7:0] 11d10[9:8] 15 131211 43210 111 disp21[20:17] 0101 k21 000 31 29 28 25 24 21 20 19 16 disp21[15:0] 15 0 0 [16]
304 32000d?04/2011 avr32 ret{cond4} ? conditional re turn from subroutine architecture revision: architecture revision1 and higher. description return from subroutine if the specified condition is true. values are moved into the return regis- ter, the return value is tested, and flags are set. operation: i. if (cond4) if (rs != {lr, sp, pc}) r12 rs; else if (rs == lr) r12 -1; else if (rs == sp) r12 0; else r12 1; test r12 and set flags; pc lr; syntax: i. ret{cond4} rs operands: i. cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} s {0, 1, ?, 15} status flags: flags are set as result of the operation cp r12, 0. q: not affected v: v 0 n: n res[31] z: z (res[31:0] == 0) c: c 0 opcode: 01011110 cond4 rs 15 1312 987 43 0
305 32000d?04/2011 avr32 retd ? return from debug mode architecture revision: architecture revision1 and higher. description return from debug mode. operation: i. sr rsr_dbg pc rar_dbg syntax: i. retd operands: none status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode : note : this instruction can only be ex ecuted in a privilege d mode. execution from any other mode will trigger a privilege violation exception. 110101100010001 1 15 98 43 0
306 32000d?04/2011 avr32 rete ? return from event handler architecture revision: architecture revision1 and higher. description returns from an exception or interrupt. sreg[l] is cleared to support atomical memory access with the stcond instruction. this instruction can only be executed in int0-int3, ex and nmi modes. execution in application or supervisor modes will trigger a privil ege violation exception. operation: i. if (microarchitecture == avr32a) sr *(sp sys ++) pc *(sp sys ++) if ( sr[m2:m0] == {b?010, b?011, b?100, b?101} ) lr *(sp sys ++) r12 *(sp sys ++) r11 *(sp sys ++) r10 *(sp sys ++) r9 *(sp sys ++) r8 *(sp sys ++) sreg[l] 0; else sr rsr current context pc rar current context sreg[l] 0; syntax: irete operands: none status flags q: not affected v: not affected n: not affected z: not affected c: not affected
307 32000d?04/2011 avr32 opcode: 110101100000001 1 15 98 43 0
308 32000d?04/2011 avr32 retj ? return from java trap architecture revision: architecture revision1 and higher. description returns from a java trap. operation: i. pc lr; j 1; r 0; if ( sr[m2:m0] == b?001 ) gm 0; syntax: iretj operands: none status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 110101100011001 1 15 98 43 0
309 32000d?04/2011 avr32 rets ? return from supervisor call architecture revision: architecture revision1 and higher. description returns from a supervisor call. operation: i. if ( sr[m2:m0] == b?000 ) issue privilege violation exception; else if ( sr[m2:m0] == b?001 ) if (microarchitecture == avr32a) sr *(sp sys ++) pc *(sp sys ++) else sr rsr sup ; pc rar sup; else pc lr current context syntax: irets operands: none status flags q: not affected v: not affected n: not affected z: not affected c: not affected opcode: 110101100001001 1 15 98 43 0
310 32000d?04/2011 avr32 retss ? return from secure state architecture revision: architecture revision 3 and higher. description returns from secure state. operation: i. if ( sr[ss] == 0 ) issue privilege violation exception; else sr ss_rsr pc ss_rar syntax: i retss operands: none status flags q: not affected v: not affected n: not affected z: not affected c: not affected opcode: 110101110110001 1 15 98 43 0
311 32000d?04/2011 avr32 rjmp ? relative jump architecture revision: architecture revision1 and higher. description jump the specified amount relative to the program counter . operation: i. pc pc + (se(disp10)<<1); syntax: i. rjmp pc[disp] operands: i. disp {-1024, -1022, ..., 1022} status flags q: not affected v: not affected n: not affected z: not affected c: not affected opcode: 1100 disp10[7:0] 10disp10[9:8] 15 131211 43210
312 32000d?04/2011 avr32 rol ? rotate left through carry architecture revision: architecture revision1 and higher. description shift all bits in rd one place to the left. the c flag is shifted into the lsb. the msb is shifted into the c flag. operation: i. c rd[31]; rd rd << 1; rd[0] c; c c; syntax: i. rol rd operands: i. d {0, 1, ?, 15} status flags: q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: c rd[31] opcode: 010111001111 rd 15 13 12 9 8 4 3 0
313 32000d?04/2011 avr32 ror ? rotate right through carry architecture revision: architecture revision1 and higher. description shift all bits in rd one place to the right. the c flag is shifted into the msb. the lsb is shifted into the c flag. operation: i. c rd[0]; rd rd >> 1; rd[31] c; c c; syntax: i. ror rd operands: i. d {0, 1, ?, 15} status flags: q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: c rd[0] opcode: 010111010000 rd 15 13 12 9 8 4 3 0
314 32000d?04/2011 avr32 rsub ? reverse subtract architecture revision: architecture revision1 and higher. description performs a subtraction and stores the result in destination register. similar to sub, but the minu- end and subtrahend are interchanged. operation: i. rd rs - rd; ii. rd se(imm8) - rs; syntax: i. rsub rd, rs ii. rsub rd, rs, imm operands: i. {d, s} {0, 1, ?, 15} ii. {d, s} {0, 1, ?, 15} imm {-128, -127, ..., 127} status flags: format i: op1 = rs, op2 = rd format ii: op1 = se(imm8), op2 = rs q: not affected v: v (op1[31] ? op2[31] ? res[31]) ( ? op1[31] op2[31] res[31]) n: n res[31] z: z (res[31:0] == 0) c: c ? op1[31] op2[31] op2[31] res[31] ? op1[31] res[31] opcode: format i: format ii: 000 rs 00010 rd 15 13 12 9 8 4 3 0 111 rs 00000 rd 31 29 28 25 24 20 19 16 00010001 imm8 15 12 11 8 7 0
315 32000d?04/2011 avr32 rsub{cond4} ? c onditional reverse subtract architecture revision: architecture revision1 and higher. architecture revision: architecture revision 2 and higher. description performs a subtraction and stores the result in destination register. similar to sub, but the minu- end and subtrahend are interchanged. operation: i. if ( cond4) rd se(imm8) - rd; syntax: i. rsub{cond4} rd, imm operands: i. d {0, 1, ?, 15} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} imm {-128, -127, ..., 127} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 1111 0 111011 rd 31 29 28 25 24 20 19 16 0000 cond4 imm8 15 12 11 8 7 0 1
316 32000d?04/2011 avr32 satadd.h ? saturated add of halfwords architecture revision: architecture revision1 and higher. description adds the two halfword registers specified and stores the result in destination register. the result is saturated if it overflows the range representable with 16 bits. if saturation occurs, the q flag is set. operation: i. temp ze(rx[15:0]) + ze(ry[15:0])); if (rx[15] ry[15] ? temp[15]) ( ? rx[15] ? ry[15] temp[15]) then if rx[15] == 0 then rd 0x00007fff; else rd 0xffff8000; else rd se(temp[15:0]); syntax: i. satadd.hrd, rx, ry operands: i. {d, x, y} {0, 1, ?, 15} status flags: q: q (rx[15] ry[15] ? temp[15]) ( ? rx[15] ? ry[15] temp[15]) q v: v (rx[15] ry[15] ? temp[15]) ( ? rx[15] ? ry[15] temp[15]) n: n rd[15] z: z if (rd[15:0] == 0) c: c 0 opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000000101100 rd 15 12 11 4 3 0
317 32000d?04/2011 avr32 satadd.w? saturated add of words architecture revision: architecture revision1 and higher. description adds the two registers specified and stores the result in destination register. the result is satu- rated if a two?s complement overflow occurs. if saturation occurs, the q flag is set. operation: i. temp rx + ry; if (rx[31] ry[31] ? temp[31]) ( ? rx[31] ? ry[31] temp[31]) then if rx[31] == 0 then rd 0x7fffffff; else rd 0x8000000; else rd temp; syntax: i. satadd.wrd, rx, ry operands: i. {d, x, y} {0, 1, ?, 15} status flags: q: q (rx[31] ry[31] ? temp[31]) ( ? rx[31] ? ry[31] temp[31]) q v: v (rx[31] ry[31] ? temp[31]) ( ? rx[31] ? ry[31] temp[31]) n: n rd[31] z: z (rd[31:0] == 0) c: c 0 opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000000001100 rd 15 12 11 4 3 0
318 32000d?04/2011 avr32 satrnds ? saturate with rounding signed architecture revision: architecture revision1 and higher. description this instruction considers the value in (rd>>sa)[bp-1:0] as a signed value. rounding is per- formed after the shift. if the value in (rd>>sa)[31:bp] is not merely a sign-extention of this value, overflow has occurred and saturation is perform ed to the maximum signed positive or negative value. if saturation occurs, the q flag is set. an arithmetic shift is performed on rd. if bp equals zero, no saturation is performed. operation: i. temp rd >> sa if (sa != 0) rnd = rd[sa-1] te m p = te m p + r n d ; if ((temp == se( temp[bp-1:0])) || (bp == 0) ) rd te m p ; else if (temp[31] == 1) rd -2 bp-1 ; else rd 2 bp-1 - 1; syntax: i. satrnds rd >> sa, bp operands: i. d {0, 1, ?, 15} {sa, bp} {0, 1, ?, 31} status flags: q: set if saturation occurred or q was already set, cleared otherwise. v: not affected n: not affected z: not affected c: not affected opcode: 1111 0111011 rd 31 29 28 25 24 20 19 16 000000 bp sa 15 12 11 10 9 5 4 0 0
319 32000d?04/2011 avr32 satrndu ? saturate with rounding unsigned architecture revision: architecture revision1 and higher. description this instruction considers the value in (rd>>sa)[bp-1:0] as a unsigned value. rounding is per- formed after the shift. if the value in (rd>>sa)[31:bp] is not merely a zero extention of this value, overflow has occurred and saturation is perfo rmed to the maximum unsigned positive value or zero. if saturation occurs, the q flag is set. an arithmetic shift is performed on rd. if bp equals zero, no saturation is performed. operation: i. temp rd >> sa if (sa != 0) rnd = rd[sa-1] te m p = te m p + r n d ; if ((temp == ze( temp[bp-1:0])) || (bp == 0) ) rd te m p ; else if (temp[31] == 1) rd 0x0000_0000; else rd 2 bp - 1; syntax: i. satrndu rd >> sa, bp operands: i. d {0, 1, ?, 15} {sa, bp} {0, 1, ?, 31} status flags: q: set if saturation occurred or q was already set, cleared otherwise. v: not affected n: not affected z: not affected c: not affected opcode: 1111 0111011 rd 31 29 28 25 24 20 19 16 000001 bp sa 15 12 11 10 9 5 4 0 0
320 32000d?04/2011 avr32 sats ? saturate signed architecture revision: architecture revision1 and higher. description this instruction considers the value in (rd>>sa)[bp-1:0] as a signed value. if the value in (rd>>sa)[31:bp] is not merely a sign-extention of this value, overflow has occurred and satura- tion is performed to the maximum signed positive or negative value. if saturation occurs, the q flag is set. an arithmetic shift is performed on rd. if bp equals zero, no saturation is performed. operation: i. temp rd >> sa if ((temp == se( temp[bp-1:0])) || (bp == 0)) rd te m p ; else if (temp[31] == 1) rd -2 bp-1 ; else rd 2 bp-1 - 1; syntax: i. sats rd >> sa, bp operands: i. d {0, 1, ?, 15} {sa, bp} {0, 1, ?, 31} status flags: q: set if saturation occurred or q was already set, cleared otherwise. v: not affected n: not affected z: not affected c: not affected opcode: 1111 0011011 rd 31 29 28 25 24 20 19 16 000000 bp sa 15 12 11 10 9 5 4 0 0
321 32000d?04/2011 avr32 satsub.h ? saturated s ubtract of halfwords architecture revision: architecture revision1 and higher. description performs a subtraction of the specified halfwords and stores the result in destination register. the result is saturated if it overflows the range representable with 16 bits. if saturation occurs, the q flag is set. operation: i. temp ze(rx[15:0]) - ze(ry[15:0]) ; if (rx[15] ? ry[15] ? temp[15]) ( ? rx[15] ry[15] temp[15]) then if rx[15]==0 then rd 0x00007fff; else rd 0xffff8000; else rd se(temp[15:0]); syntax: i. satsub.hrd, rx, ry operands: i. {d, s} {0, 1, ?, 15} status flags: q: q (rx[15] ? ry[15] ? temp[15]) ( ? rx[15] ry[15] temp[15]) q v: v (rx[15] ? ry[15] ? temp[15]) ( ? rx[15] ry[15] temp[15]) n: n rd[15] z: z (rd[15:0] == 0) c: c 0 opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000000111100 rd 15 12 11 4 3 0
322 32000d?04/2011 avr32 satsub.w ? saturated subtract of words architecture revision: architecture revision1 and higher. description performs a subtraction and stores the result in destination register. the result is saturated if a two?s complement overflow occurs. if saturation occurs, the q flag is set. operation: i. temp rx - ry; ii. temp rs - se(imm16)); format i: op1 = rx, op2 = ry format ii: op1 = rs, op2 = se(imm16) if (op1[31] ? op2[31] ? temp[31]) ( ? op1[31] op2[31] temp[31]) then if(op1[31]==0) then rd 0x7fffffff; else rd 0x80000000; else rd temp syntax: i. satsub.w rd, rx, ry ii. satsub.w rd, rs, imm operands: i. {d, x, y} {0, 1, ?, 15} ii. {d, s} {0, 1, ?, 15} imm {-32768, -32767, ..., 32767} status flags: format i: op1 = rx, op2 = ry format ii: op1 = rs, op2 = se(imm16) q: q (op1[31] ? op2[31] ? temp[31]) ( ? op1[31] op2[31] temp[31]) q v: v (op1[31] ? op2[31] ? temp[31]) ( ? op1[31] op2[31] temp[31]) n: n rd[31] z: z (rd[31:0] == 0) c: c 0 opcode:
323 32000d?04/2011 avr32 format i: format ii: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000000011100 rd 15 12 11 4 3 0 111 rs 01101 rd 31 29 28 25 24 20 19 16 imm16 15 0
324 32000d?04/2011 avr32 satu ? saturate unsigned architecture revision: architecture revision1 and higher. description this instruction considers the value in (rd>>sa)[bp-1:0] as a unsigned value. if the value in (rd>>sa)[31:bp] is not merely a zero extention of this value, overflow has occurred and satura- tion is performed to the maximum unsigned positive value or zero. if saturation occurs, the q flag is set. an arithmetic shift is performed on rd. if bp equals zero, no saturation is performed. operation: i. temp rd >> sa if ((temp == ze( temp[bp-1:0])) || (bp == 0) ) rd te m p ; else if (temp[31] == 1) rd 0x0000_0000; else rd 2 bp - 1; syntax: i. satu rd >> sa, bp operands: i. d {0, 1, ?, 15} {sa, bp} {0, 1, ?, 31} status flags: q: set if saturation occurred or q was already set, cleared otherwise. v: not affected n: not affected z: not affected c: not affected opcode: 1111 0011011 rd 31 29 28 25 24 20 19 16 000001 bp sa 15 12 11 10 9 5 4 0 0
325 32000d?04/2011 avr32 sbc ? subtract with carry architecture revision: architecture revision1 and higher. description subtracts a specified register and the value of the carry bit from a destination register and stores the result in the destination register. operation: i. rd rx - ry - c; syntax: i. sbc rd, rx, ry operands: i. {x, y, d} {0, 1, ?, 15} status flags: q: not affected. v: v (rx[31] ? ry[31] ? res[31]) ( ? rx[31] ry[31] res[31]) n: n res[31] z: z (res[31:0] == 0) z c: c ? rx[31] ry[31] ry[31] res[31] ? rx[31] res[31] opcode: 111 rx 00000 ry 31 29 28 25 24 20 19 16 000000010100 rd 15 12 11 4 3 0
326 32000d?04/2011 avr32 sbr ? set bit in register architecture revision: architecture revision1 and higher. description sets a bit in the specified register. all other bits are unaffected. operation: i. rd[bp5] 1; syntax: i. sbr rd, bp operands: i. d {0, 1, ?, 15} bp {0, 1, ?, 31} status flags: q: not affected v: not affected n: not affected z: z 0 c: not affected opcode: 101 bp[4:1] 1101bp[0] rd 15 1312 98 543 0
327 32000d?04/2011 avr32 scall ? supervisor call architecture revision: architecture revision1 and higher. description the scall instruction performs a supervisor routine call. the behaviour of the instruction is dependent on the mode it is called from, allowing scall to be executed from all contexts. scall jumps to a dedicated entry point relative to evba. scall can use the same call convention as regular subprogram calls. operation: i. if ( sr[m2:m0] == {b?000 or b?001} ) if (microarchitecture == avr32a) *(--sp sys ) pc + 2; *(--sp sys ) sr; pc evba + 0x100; sr[m2:m0] b?001; else rar sup pc + 2; rsr sup sr; pc evba + 0x100; sr[m2:m0] b?001; else lr current context pc + 2; pc evba + 0x100; syntax: i. scall operands: i. none status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: 1101011100110011 15 98 43 0
328 32000d?04/2011 avr32 scr ? subtract ca rry from register architecture revision: architecture revision1 and higher. description subtracts carry from the specified destination register. operation: i. rd rd - c; syntax: i. scr rd operands: i. d {0, 1, ?, 15} status flags: q: not affected v: v (rd[31] ? res[31]) n: n res[31] z: z (res[31:0] == 0) z c: c ? rd[31] res[31] opcode: example ; subtract a 32-bit variable (r0) from a 64-bit variable (r2:r1) sub r1, r0 scr r2 010111000001 rd 15 13 12 4 3 0
329 32000d?04/2011 avr32 sleep ? set cpu activity mode architecture revision: architecture revision1 and higher. description sets the system in the sleep mode specified by the implementation defined op8 operand. the semantic of op8 is implementation defined. if bit 7 in op8 is one, sr[gm] will be cleared when entering sleep mode. operation: i. set the system in the specified sleep mode. syntax: i. sleep op8 operands: i. op8 {0, 1, ?, 255} status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: note: the sleep instruction is a privileged instruction, and will trigger a privilege violation exception if executed in user mode. 1110 00110110 00 31 29 28 25 24 20 19 16 00000000 op8 15 8 7 0 10
330 32000d?04/2011 avr32 sr{cond4} ? set regi ster conditionally architecture revision: architecture revision1 and higher. description sets the register specified to 1 if the condition specified is true, clear the register otherwise. operation: i. if (cond4) rd 1; else rd 0; syntax: i. sr{cond4} rd operands: i. cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} d {0, 1, ..., 15} status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: 01011111 cond4 rd 15 1312 987 43 0
331 32000d?04/2011 avr32 sscall ? secure state call architecture revision: architecture revision 3 and higher. description the sscall instruction performs a secure state call. sscall can use the same call convention as regular subprogram calls. operation: i. ss_rar pc; ss_rsr sr; if (microarchitecture == avr32a) pc 0x8000_0004; else) pc 0xa000_0004; sr[ss] 1; sr[gm] 1; if (sr[m2:m0] == 0) sr[m2:m0] 001; syntax: i. sscall operands: i. none status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: 1101011101010011 15 98 43 0
332 32000d?04/2011 avr32 ssrf ? set stat us register flag architecture revision: architecture revision1 and higher. description sets the status register (sr) flag specified. operation: i. sr[bp5] 1; syntax: i. ssrf bp operands: i. bp {0, 1, ?, 31} status flags: sr[bp5] 1, all other flags unchanged. opcode: note: privileged if bp5 > 15, ie. upper half of status r egister. an exception will be triggered if the upper half of the status register is attempted changed in user mode. 1101001 bp5 0011 15 11 10 9 8 4 3 0
333 32000d?04/2011 avr32 st.b ? store byte architecture revision: architecture revision1 and higher. description the source register is stored to the byte memory location referred to by the pointer address. operation: i. *(rp) rs[7:0]; rp rp + 1; ii. rp rp - 1; *(rp) rs[7:0]; iii. *(rp + ze(disp3)) rs[7:0]; iv. *(rp + se(disp16)) rs[7:0]; v. *(rb + (ri << sa2)) rs[7:0]; syntax: i. st.b rp++, rs ii. st.b --rp, rs iii. st.b rp[disp], rs iv. st.b rp[disp], rs v. st.b rb[ri << sa], rs operands: i, ii. {s , p} {0, 1, ?, 15} iii. {s , p} {0, 1, ?, 15} disp {0, 1, ..., 7} iv. {s , p} {0, 1, ?, 15} disp {-32768, -32767, ..., 32767} v. {b, i, s} {0, 1, ?, 15} sa {0, 1, 2, 3} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 000 rp 01100 rs 15 13 12 9 8 4 3 0
334 32000d?04/2011 avr32 format ii: format iii: format iv: format v: note: for formats i. and ii., if rp = rs the result will be undefined. 000 rp 01111 rs 15 13 12 9 8 4 3 0 101 rp 01 disp3 rs 15 1312 9876 43 0 111 rp 10110 rs 31 29 28 25 24 20 19 16 disp16 15 0 111 rb 00000 ri 31 29 28 25 24 20 19 16 0000101100 shift amount rs 15 12 11 8 7 6 5 4 3 0
335 32000d?04/2011 avr32 st.b{cond4} ? condit ionally store byte architecture revision: architecture revision 2 and higher. description the source register is stored to the byte memory location referred to by the pointer address if the given condition is satisfied. operation: i. if (cond4) *(rp + ze(disp9)) rs[7:0]; syntax: i. st.b{cond4} rp[disp], rs operands: i. s, p {0, 1, ?, 15} disp {0, 1, ..., 511} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 11111 31 29 28 25 24 20 19 16 cond4 1 1 1 disp9 15 12 11 8 7 6 5 4 3 0 rd rp
336 32000d?04/2011 avr32 st.d ? store doubleword architecture revision: architecture revision1 and higher. description the source registers are stored to the doubleword memory location referred to by the pointer address. operation: i. *(rp) rs+1:rs; rp rp + 8; ii. rp rp - 8; *(rp) rs+1:rs; iii. *(rp) rs+1:rs; iv. *(rp + se(disp16)) rs+1:rs; v. *(rb + (ri << sa2)) rs+1:rs; syntax: i. st.d rp++, rs ii. st.d --rp, rs iii. st.d rp, rs iv. st.d rp[disp], rs v. st.d rb[ri << sa], rs operands: i, ii, iii. p {0, 1, ?, 15} s {0, 2, ?, 14} iv. p {0, 1, ?, 15} s {0, 2, ?, 14} disp {-32768, -32767, ..., 32767} v. { b, i } {0, 1, ?, 15} s {0, 2, ?, 14} sa {0, 1, 2, 3} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode:
337 32000d?04/2011 avr32 format i: format ii: format iii: format iv: format v: note: for formats i. and ii., if rp == rs the result will be undefined. 101 rp 10010 rs 0 15 1312 98 6543 10 101 rp 10010 rs 1 15 1312 98 6543 10 101 rp 10001 rs 1 15 13 12 9 8 4 3 0 111 rp 01110 rs 1 31 29 28 25 24 20 19 17 16 disp16 15 0 111 rb 00000 ri 31 29 28 25 24 20 19 16 0000100000 shift amount rs 15 12 11 8 7 6 5 4 3 0
338 32000d?04/2011 avr32 st.h ? store halfword architecture revision: architecture revision1 and higher. description the source register is stored to the halfword memory location referred to by the pointer address. operation: i. *(rp) rs[15:0]; rp rp + 2; ii. rp rp - 2; *(rp) rs[15:0]; iii. *(rp + ze(disp3 << 1)) rs[15:0]; iv. *(rp + se(disp16)) rs[15:0]; v. *(rb + (ri << sa2)) rs[15:0]; syntax: i. st.h rp++, rs ii. st.h --rp, rs iii. st.h rp[disp], rs iv. st.h rp[disp], rs v. st.h rb[ri << sa], rs operands: i, ii. {s , p} {0, 1, ?, 15} iii. {s , p} {0, 1, ?, 15} disp {0, 2, ..., 14} iv. {s , p} {0, 1, ?, 15} disp {-32768, -32767, ..., 32767} v. {b, i, s} {0, 1, ?, 15} sa {0, 1, 2, 3} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 000 rp 01011 rs 15 13 12 9 8 4 3 0
339 32000d?04/2011 avr32 format ii: format iii: format iv: format v: note: for formats i. and ii., if rp == rs the result will be undefined. 000 rp 01110 rs 15 13 12 9 8 4 3 0 101 rp 00 disp3 rs 15 1312 9876 43 0 111 rp 10101 rs 31 29 28 25 24 20 19 16 disp16 15 0 111 rb 00000 ri 31 29 28 25 24 20 19 16 0000101000 shift amount rs 15 12 11 8 7 6 5 4 3 0
340 32000d?04/2011 avr32 st.h{cond4} ? conditio nally store halfword architecture revision: architecture revision 2 and higher. description the source register is stored to the halfword memory location referred to by the pointer address if the given condition is satisfied. operation: i. if (cond4) *(rp + ze(disp9<<1)) rs[15:0]; syntax: i. st.h{cond4} rp[disp], rs operands: i. s, p {0, 1, ?, 15} disp {0, 2, ..., 1022} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 11111 31 29 28 25 24 20 19 16 cond4 1 1 0 disp9 15 12 11 8 7 6 5 4 3 0 rs rp
341 32000d?04/2011 avr32 st.w ? store word architecture revision: architecture revision1 and higher. description the source register is stored to the word memory location referred to by the pointer address. operation: i. *(rp) rs; rp rp + 4; ii. rp rp - 4; *(rp) rs; iii. *(rp + ze(disp4 << 2)) rs; iv. *(rp + se(disp16)) rs; v. *(rb + (ri << sa2)) rs; syntax: i. st.w rp++, rs ii. st.w --rp, rs iii. st.w rp[disp], rs iv. st.w rp[disp], rs v. st.w rb[ri << sa], rs operands: i, ii. {s , p} {0, 1, ?, 15} iii. {s , p} {0, 1, ?, 15} disp {0, 4, ..., 60} iv. {s , p} {0, 1, ?, 15} disp {-32768, -32767,?, 32767} v. {b, i, s} {0, 1, ?, 15} sa {0, 1, 2, 3} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 000 rp 01010 rs 15 13 12 9 8 4 3 0
342 32000d?04/2011 avr32 format ii: format iii: format iv: format v: note: for formats i. and ii., if rp == rs the result will be undefined. 000 rp 01101 rs 15 13 12 9 8 4 3 0 1 0 0 rp 1 disp4 rs 15 1312 987 43 0 111 rp 10100 rs 31 29 28 25 24 20 19 16 disp16 15 0 111 rb 00000 ri 31 29 28 25 24 20 19 16 0000100100 shift amount rs 15 12 11 8 7 6 5 4 3 0
343 32000d?04/2011 avr32 st.w{cond4} ? conditi onally store word architecture revision: architecture revision 2 and higher. description the source register is stored to the word memory location referred to by the pointer address if the given condition is satisfied. operation: i. if (cond4) *(rp + ze(disp9<<2)) rs; syntax: i. st.w{cond4} rp[disp], rs operands: i. s, p {0, 1, ?, 15} disp {0, 4, ..., 2044} cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 111 11111 31 29 28 25 24 20 19 16 cond4 1 0 1 disp9 15 12 11 8 7 6 5 4 3 0 rd rp
344 32000d?04/2011 avr32 stc.{d,w} ? store coprocessor architecture revision: architecture revision1 and higher. description stores the source register value to the location specified by the addressing mode. operation: i. *(rp + (ze(disp8) << 2)) cp#(crd+1:crd); ii. *(rp) cp#(crd+1:crd); rp rp+8; iii. *(rb + (ri << sa2)) cp#(crd+1:crd); iv. *(rp + (ze(disp8) << 2)) cp#(crd); v. * ( r p ) cp#(crd); rp rp+4; vi. *(rb + (ri << sa2)) cp#(crd); syntax: i. stc.d cp#, rp[disp], crs ii. stc.d cp#, rp++, crs iii. stc.d cp#, rb[ri< 345 32000d?04/2011 avr32 format i: format ii: format iii: format iv: format v: format vi: example: stc.d cp2, r2[0], cr0 1110 0111010 rp 31 29 28 25 24 20 19 16 cp # 1 crs[3:1] 0 disp8 15 13 12 11 8 7 0 1 1110 1111010 rp 31 29 28 25 24 20 19 16 cp # 0crs[3:1] 001110 00 15 13 12 11 9 8 7 0 1 0 1110 1111010 rp 31 29 28 25 24 20 19 16 cp # 1 crs[3:1] 0 1 1 sh amt ri 15 13 12 11 9 8 7 6 5 4 3 0 1 1110 0111010 rp 31 29 28 25 24 20 19 16 cp # 0 crs disp8 15 13 12 11 8 7 0 1 1110 1111010 rp 31 29 28 25 24 20 19 16 cp # 0 01100 00 15 13 12 11 8 7 0 1 0 crs 1110 1111010 rp 31 29 28 25 24 20 19 16 cp # 1 1 0 sh amt ri 15 13 12 11 8 7 6 5 4 3 0 1 crs
346 32000d?04/2011 avr32 stc0.{d,w} ? store coprocessor 0 register architecture revision: architecture revision1 and higher. description stores the coprocessor 0 source register value to the location specified by the addressing mode. operation: i. *(rp + (ze(disp12) << 2)) cp#(crd+1:crd); ii. *(rp + (ze(disp12) << 2)) cp#(crd); syntax: i. stc0.d rp[disp], crs ii. stc0.w rp[disp], crs operands: i-ii. p {0, 1, ?, 15} i. s {0, 2, ?, 14} ii. s {0, 1, ?, 15} i, iv. disp {0, 4, ?, 16380} status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: format i: format ii: example: stc0.d r2[0], cr0 1111 1111010 rp 31 29 28 25 24 20 19 16 disp[11:8] crs[3:1] 0 disp[7:0] 15 12 11 8 7 0 0 1111 1011010 rp 31 29 28 25 24 20 19 16 disp[11:8] crs disp[7:0] 15 12 11 8 7 0 0
347 32000d?04/2011 avr32 stcm.{d,w} ? store coproce ssor multiple registers architecture revision: architecture revision1 and higher. description writes multiple registers in the addressed coprocessor into the specified memory locations. operation: i. storeaddress rp; if opcode[--] == 1 then for (i = 0 to 7) if reglistcpd8[i] == 1 then *(--storeaddress) cp#(cr(2*i)); *(--storeaddress) cp#(cr(2*i+1)); rp storeaddress; else for (i = 7 to 0) if reglistcpd8[i] == 1 then *(storeaddress++) cp#(cr(2*i+1)); *(storeaddress++) cp#(cr(2*i)); ii storeaddress rp; if opcode[--] == 1 then for (i = 0 to 7) if reglistcph8[i] == 1 then *(--storeaddress) cp#(cri+8); rp storeaddress; else for (i = 7 to 0) if reglistcph8[i] == 1 then *(storeaddress++) cp#(cri+8); iii storeaddress rp; if opcode[--] == 1 then for (i = 0 to 7) if reglistcpl8[i] == 1 then *(--storeaddress) cp#(cri); rp storeaddress; else for (i = 7 to 0) if reglistcpl8[i] == 1 then *(storeaddress++) cp#(cri);
348 32000d?04/2011 avr32 syntax: i. stcm.d cp#, {--}rp, reglistcpd8 ii. stcm.w cp#, {--}rp, reglistcph8 iii. stcm.w cp#, {- -}rp, reglistcpl8 operands: i-iii. # {0, 1, ?, 7} p {0, 1, ?, 15} i. reglistcpd8 {cr0-cr1,cr2-cr3,cr4- cr5,cr6-cr7,cr8-cr9, cr10-cr11,cr12-cr13,cr14-cr15} ii. reglistcph8 {cr8, cr9, cr10, ..., cr15} iii. reglistcpl8 {cr0, cr1, cr2, ..., cr7} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: format ii: format iii: example: stcm.w cp2, --sp, cr2-cr5 note: emtpy reglistcph8/reglistcpl8/r eglistcpd8 gives undefined result. 1110 1011010 rp 31 29 28 25 24 20 19 16 cp# -- 0101 cr 15 13 12 11 8 7 0 1 15-14 cr 13-12 cr 11-10 cr 9-8 cr 7-6 cr 5-4 cr 3-2 cr 1-0 1110 1011010 rp 31 29 28 25 24 20 19 16 cp# -- 0011 cr 15 13 12 11 8 7 0 1 15 cr 14 cr 13 cr 12 cr 11 cr 10 cr 9 cr 8 1110 1011010 rp 31 29 28 25 24 20 19 16 cp# -- 0010 cr 15 13 12 11 8 7 0 1 7 cr 6 cr 5 cr 4 cr 3 cr 2 cr 1 cr 0
349 32000d?04/2011 avr32 stcond ? store word conditionally architecture revision: architecture revision1 and higher. description the source register is stored to the word memory location referred to by the pointer address if sreg[l] is set. also, sreg[l] is copied to sreg[z] to indicate a success or failure of the oper- ation. this instruction is used for atomical memory access. operation: i. sreg[z] sreg[l]; if sreg[l] *(rp + se(disp16)) rs; syntax: i. stcond rp[disp], rs operands: i. {s , p} {0, 1, ?, 15} disp {-32768, -32767, ..., 32767} status flags: q: not affected. v: not affected. n: not affected. z: sreg[z] sreg[l]. c: not affected. opcode: note: 111 rp 10111 rs 31 29 28 25 24 20 19 16 disp16 15 0
350 32000d?04/2011 avr32 stdsp ? store stack-pointer relative architecture revision: architecture revision1 and higher. description stores the source register value to the memory location referred to specified by the stack pointer and the displacement. operation: i. *( (sp && 0xffff_fffc) + (ze(disp7) << 2) ) rs; syntax: i. stdsp sp[disp], rs operands: i. disp {0, 4, ..., 508} s {0, 1, ?, 15} status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: 01010 disp7 rs 15 13 12 11 10 4 3 0
351 32000d?04/2011 avr32 sthh.w ? store halfwords into word architecture revision: architecture revision1 and higher. description the selected halfwords of the source registers are combined and stored to the word memory location referred to by the pointer address. operation: if (rx-part == t) then high-part = rx[31:16] else high-part = rx[15:0]; if (ry-part == t) then low-part = ry[31:16] else low-part = ry[15:0]; i. *(rp + ze(disp8 << 2)) {high-part, low-part}; ii. *(rb + (ri << sa2)) {high-part, low-part}; syntax: i. sthh.w rp[disp], rx:, ry: ii. sthh.w rb[ri << sa], rx:, ry: operands: i. {p, x, y} {0, 1, ?, 15} disp {0, 4, ..., 1020} part {b,t} ii. {b, i, x, y} {0, 1, ?, 15} sa {0, 1, 2, 3} part {b,t} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: format i: 111 rx 11110 ry 31 29 28 25 24 20 19 16 11xy disp8 rp 15 14 13 12 11 4 3 0
352 32000d?04/2011 avr32 format ii: 111 rx 11110 ry 31 29 28 25 24 20 19 16 10xy ri 00 sa2 rb 15 14 13 12 11 8 7 6 5 4 3 0
353 32000d?04/2011 avr32 stm ? store multiple registers architecture revision: architecture revision1 and higher. description stores the registers specified to the consecutive memory locations pointed to by rp. both regis- ters in the register file and some of the special-purpose registers can be stored. i. storeaddress rp; if opcode[--] == 1 then for (i = 0 to 15) if reglist16[i] == 1 then *(--storeaddress) ri; rp storeaddress; else for (i = 15 to 0) if reglist16[i] == 1 then *(storeaddress++) ri; syntax: i. stm {--}rp, reglist16 operands: i. reglist16 {r0, r1, r2, ..., r12, lr, sp, pc} p {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: note: emtpy reglist16 gives undefined result. if rp is in reglist16 and pointer is written back the result is undefined the r bit in the status register has no effect on this instruction. 1110 0-- 11100 rp 31 29 28 26 25 24 20 19 16 r15 r14 r13 r12 r11 r10 r9 r8 r7 r6 r5 r4 r3 r2 r1 r0 15 0 1
354 32000d?04/2011 avr32 stmts ? store multiple registers for task switch architecture revision: architecture revision1 and higher. description stores the registers specified to the consecutive memory locations pointed to by rp. the regis- ters specified all reside in the application context. i. storeaddress rp; if opcode[--] == 1 then for (i = 0 to 15) if reglist16[i] == 1 then *(--storeaddress) ri app ; rp storeaddress; else for (i = 15 to 0) if reglist16[i] == 1 then *(storeaddress++) ri app ; syntax: i. stmts {--}rp, reglist16 operands: i. reglist16 {r0, r1, r2, ..., r12, lr, sp} p {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: note: emtpy reglist16 gives undefined result. pc in reglist16 gives undefined result. 1110 1-- 11100 rp 31 29 28 26 25 24 20 19 16 r15 r14 r13 r12 r11 r10 r9 r8 r7 r6 r5 r4 r3 r2 r1 r0 15 0 1
355 32000d?04/2011 avr32 stswp.{h, w} ? swap and store architecture revision: architecture revision1 and higher. description this instruction swaps the bytes in a halfword or a word in the register file and stores the result to memory. the instruction can be used for performing stores to memories of different endianness. operation: i. temp[15:0] (rs[7:0], rs[15:8]); *(rp+se(disp12) << 1) temp[15:0]; ii. temp[31:0] (rs[7:0], rs[15:8], rs[23:16], rs[31:24]); *(rp+se(disp12) << 2) temp[31:0]; syntax: i. stswp.h rp[disp], rs ii. stswp.w rp[disp], rs operands: i. {s, p} {0, 1, ?, 15} disp {-4096, -4094, ..., 4094} ii. {s, p} {0, 1, ?, 15} disp {-8192, -8188 ..., 8188} status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: format i: format ii: 111 rp 11101 rs 31 29 28 25 24 20 19 16 1001 disp12 15 12 11 0 111 rp 11101 rs 31 29 28 25 24 20 19 16 1010 disp12 15 12 11 0
356 32000d?04/2011 avr32 sub ? subtract (without carry) architecture revision: architecture revision1 and higher. description performs a subtraction and stores the result in destination register. operation: i. rd rd - rs; ii. rd rx - (ry << sa2); iii. if (rd == sp) rd rd - se(imm8 << 2); else rd rd - se(imm8); iv. rd rd - se(imm21); v. r d rs - se(imm16); syntax: i. sub rd, rs ii. sub rd, rx, ry << sa iii. sub rd, imm iv. sub rd, imm v. sub rd, rs, imm operands: i-v. {d, s, x, y} {0, 1, ?, 15} ii. sa {0, 1, 2, 3} iii. if (rd == sp) imm {-512, -508, ..., 508} else imm {-128, -127, ..., 127} iv. imm {-1048576, -104875, ..., 1048575} v. i m m {-32768, -32767, ..., 32767} status flags: format i: op1 = rd, op2 = rs format ii:op1 = rx, op2 = ry << sa2 format iii: op1 = rd, if (rd==sp) op2 = se(imm8<<2) else op2 = se(imm8) format iv: op1 = rd, op2 = se(imm21) format v: op1 = rs, op2 = se(imm16) q: not affected v: v (op1[31] ? op2[31] ? res[31]) ( ? op1[31] op2[31] res[31]) n: n res[31] z: z (res[31:0] == 0) c: c ? op1[31] op2[31] op2[31] res[31] ? op1[31] res[31]
357 32000d?04/2011 avr32 opcode: format i: format ii: format iii: format iv: format v: 000 rs 00001 rd 15 13 12 9 8 4 3 0 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000000100 shift amount rd 15 12 11 8 7 6 5 4 3 0 0010 imm8 rd 15 13 12 11 4 3 0 111 imm21[20:17 0001 imm21 rd 31 29 28 25 24 21 20 19 16 imm21[15:0] 15 0 [16] 111 rs 01100 rd 31 29 28 25 24 20 19 16 imm16 15 0
358 32000d?04/2011 avr32 sub{cond4} ? condi tional subtract architecture revision: format i in architecture revision1 and higher. format ii in architecture revision 2 and higher. description subtracts a value from a given register and stores the result in destination register if cond4 is true. operation: i. if (cond4) then rd rd - imm8; update flags if opcode[f] field is cleared ii. if (cond4) then rd rx - ry; syntax: i. sub{f}{cond4} rd, imm ii. sub{cond4} rd, rx, ry operands: i. cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} d {0, 1, ?, 15} imm {-128, -127, ..., 127} ii. cond4 {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al} {d, x, y} {0, 1, ?, 15} status flag : k = se(imm8) flags only affected if format i and (cond4) is true and f parameter is given q: not affected v: v (rd[31] ? k[31] ? res[31]) ( ? rd[31] k[31] res[31]) n: n res[31] z: z (res[31:0] == 0) c: c ? rd[31] k[31] k[31] res[31] res[31] ? rd[31] opcode: format i:i 1111 1f11011 rd 31 29 28 26 25 24 20 19 16 0000 cond4 imm8 15 12 11 8 7 0 0
359 32000d?04/2011 avr32 format ii: example: subfeq r3, 5 performs r3 r3 - 5 and sets flags accordingly if z flag set. subeq r5, 7 performs r5 r5 - 5 if z flag set. flags are not affected. 111 11101 ry 31 29 28 25 24 20 19 16 1110 cond4 0001 rd 15 12 11 8 7 0 rx
360 32000d?04/2011 avr32 subhh.w? subtract halfwords into word architecture revision: architecture revision1 and higher. description subtracts the two halfword registers specified and stores the result in the destination word-regis- ter. the halfword registers are selected as either the high or low part of the operand registers. operation: i. if (rx-part == t) then operand1 = se(rx[31:16]) else operand1 = se(rx[15:0]); if (ry-part == t) then operand2 = se(ry[31:16]) else operand2 = se(ry[15:0]); rd operand1 - operand2; syntax: i. subhh.wrd, rx:, ry: operands: i. {d, x, y} {0, 1, ?, 15} part {t,b} status flags: op1 = operand1, op2 = operand2 q: not affected v: v (op1[31] ? op2[31] ? res[31]) ( ? op1[31] op2[31] res[31]) n: n res[31] z: z (res[31:0] == 0) c: c ? op1[31] op2[31] op2[31] res[31] ? op1[31] res[31] opcode: example: subhh.wr10, r2:t, r3:b will perform r10 se(r2[31:16]) - se(r3[15:0]) 111 rx 00000 ry 31 29 28 25 24 20 19 16 0000111100xy rd 15 12 11 6 5 4 3 0
361 32000d?04/2011 avr32 swap.b ? swap bytes architecture revision: architecture revision1 and higher. description swaps different parts of a register. operation: i. temp rd; rd[31:24] temp[7:0]; rd[23:16] temp[15:8]; rd[15:8] temp[23:16]; rd[7:0] temp[31:24]; syntax: i. swap.b rd operands: i. d {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 010111001011 rd 15 13 12 9 8 4 3 0
362 32000d?04/2011 avr32 swap.bh ? swap bytes in halfword architecture revision: architecture revision1 and higher. description swaps different parts of a register. operation: i. temp rd; rd[31:24] temp[23:16]; rd[23:16] temp[31:24]; rd[15:8] temp[7:0]; rd[7:0] temp[15:8]; syntax: i. swap.bhrd operands: i. d {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 010111001100 rd 15 13 12 9 8 4 3 0
363 32000d?04/2011 avr32 swap.h ? swap halfwords architecture revision: architecture revision1 and higher. description swaps different parts of a register. operation: i. temp rd; rd[31:16] temp[15:0]; rd[15:0] temp[31:16]; syntax: i. swap.h rd operands: i. d {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 010111001010 rd 15 13 12 9 8 4 3 0
364 32000d?04/2011 avr32 sync ? synchronize memory architecture revision: architecture revision1 and higher. description finish all pending memory accesses and empties write buffers. the semantic of op8 is imple- mentation defined. operation: i. finishes all pending memory operations. syntax: i. sync op8 operands: i. 0 op8 255 status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: 1110 01110110 0 0 31 29 28 25 24 20 19 16 00000000 op8 15 8 7 0 10
365 32000d?04/2011 avr32 tlbr ? read tlb entry architecture revision: architecture revision1 and higher. description read the contents of the addressed itlb or dtlb entry into tlbehi and tlbelo. operation: i. if (tlbehi[i] == 1) {tlbehi, tlbelo} itlb[mmucr[irp]]; else {tlbehi, tlbelo} dtlb[mmucr[drp]]; syntax: i. tlbr operands: none status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: note: this instruction can only be executed in a privileged mode. 110101100100001 1 15 98 43 0
366 32000d?04/2011 avr32 tlbs ? search tlb for entry architecture revision: architecture revision1 and higher. description search the addressed tlb for an entry matching tlb entry high and low (tlbehi/tlbelo) registers. return a pointer to the entry in mmucr[irp] or mmucr[drp] if a match found, oth- erwise set the not found bit in t he mmu control register, mmucr[n]. operation: i. mmucr[n] 1; if (tlbehi[i] == 1) tlbtosearch itlb; else tlbtosearch dtlb; endif; for (i = 0 to tlbtosearchentries-1) if ( compare(tlbtosearch[i] vpn , va, tlbtosearch[i] sz , tlbtosearch[i] v ) ) // vpn and va matches for the given page size and entry valid if ( sharedvmm or (privatevmm and ( tlbtosearch[i] g or (tlbtosearch[i] asid ==tlbehi[asid]) ) ) ) ptr i; mmucr[n] 0; endif; endif; endfor; if (tlbehi[i] == 1) mmucr[irp] ptr; else mmucr[drp] ptr; endif; syntax: i. tlbs operands: none status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected.
367 32000d?04/2011 avr32 opcode: note: this instruction can only be executed in a privileged mode. 110101100101001 1 15 98 43 0
368 32000d?04/2011 avr32 tlbw ? write tlb entry architecture revision: architecture revision1 and higher. description write the contents of the tlb entry high and low (tlbehi/tlbelo) registers into the addressed tlb entry. operation: i. if (tlbehi[i] == 1) itlb[mmucr[irp]] {tlbehi, tlbelo}; else itlb[mmucr[drp]] {tlbehi, tlbelo}; syntax: i. tlbw operands: none status flags: q: not affected. v: not affected. n: not affected. z: not affected. c: not affected. opcode: note: this instruction can only be executed in a privileged mode. 110101100110001 1 15 98 43 0
369 32000d?04/2011 avr32 tnbz ? test if no by te is equal to zero architecture revision: architecture revision1 and higher. description if any of the bytes 0,1,2,3 in the word is zero, the sr[z] flag is set. operation: i. if (rd[31:24] == 0 rd[23:16] == 0 rd[15:8] == 0 rd[7:0] == 0 ) sr[z] 1; else sr[z] 0; syntax: i. tnbz rd operands: i. d {0, 1, ?, 15} status flags: q: not affected. v: not affected. n: not affected. z: z (rd[31:24] == 0 rd[23:16] == 0 rd[15:8] == 0 rd[7:0] == 0 ) c: not affected. opcode: 010111001110 rd 15 13 12 9 8 4 3 0
370 32000d?04/2011 avr32 tst ? test register architecture revision: architecture revision1 and higher. description test register. used to check if a subset of a register includes one or more set bits. no writeback of the result is performed, but the flags are set. operation: i. rd rs; syntax: i. tst rd, rs operands : i. {d,s} {0, 1, ?, 15} status flags q: not affected v: not affected n: n res[31] z: z (res[31:0] == 0) c: not affected opcode(s) 000 rs 00111 rd 15 13 12 9 8 4 3 0
371 32000d?04/2011 avr32 xchg ? exchange register and memory architecture revision: architecture revision1 and higher. description reads a word from memory pointed to by rx into register rd, and writes the value of register ry to memory. this instruction can be used to implement binary semaphores (mutexes). the stcond instruction should be used to implement counting semaphores. operation: i. temp *(rx); *(rx) ry; rd te m p ; syntax: i. xchg rd, rx, ry operands: i. {d,x,y} {0, 1, ?, 14} status flags: q: not affected v: not affected n: not affected z: not affected c: not affected opcode: note: if r15 is used as rd, rx or ry, the result is undefined. if rd = ry, the result is undefined. if rd = rx, the result is undefined. 111 rx 00000 ry 31 29 28 25 24 20 19 16 000010110100 rd 15 12 11 4 3 0
372 32000d?04/2011 avr32
373 32000d?04/2011 avr32 10. revision history 10.1 rev. 32000a-02/2006 10.2 rev. 32000b-11/2007 10.3 rev. 32000c-08/2009 10.4 rev. 32000d-04/2011 1. initial version. 1. improved description of rete in instruction set chapter. 2. corrected description of stc.d in instruction set chapter. 3. added micro-tlb miss performance counting. 4. added clear-on-compare functionality to count system register 5. updated mpu description to match implementation 6. added new architecture revision 2 instructions 1. corrected typos in the movh instruction description. 2. corrected reset address typo in chapter 7.3.1.1 3. corrected typos in rete, divs and divu detailed instruction set descriptions. 4. described new architecture revision 3 secure execution state. 5. automatic clear of count on compare match can now be overridden, usually by writing a bit in the im plementation?s cpucr register. 1. flashvault ? description added 2. instruction syntax: each ri has been replaced by ri: in the instruc- tion set summary and descriptions 3. added description of bit 7 in op8 in sleep instruction 4. parantheses added to shift instruction descriptions to clarify the order of the operations 5. added cond4 to ld.sb, ld.ub, ld.sh, ld.uh, ld.w, st.b, st.h, st.w instruction descrip- tion syntax 6. se replaced by ze in st.w{cond4} in the instruction set summary table
374 32000d?04/2011 avr32
i 32000d?04/2011 avr32 table of contents feature summary.......... ................. ................ ................. .............. ............ 1 1 introduction .............. ................ ................ ................. ................ ............... 2 1.1 the avr family ..................................................................................................2 1.2 the avr32 microprocessor architecture .........................................................2 1.3 microarchitectures .............................................................................................4 2 programming model ........... .............. ............... .............. .............. ............ 5 2.1 data formats .....................................................................................................5 2.2 data organization ..............................................................................................5 2.3 instruction organization .....................................................................................6 2.4 processor states ...............................................................................................7 2.5 entry and exit mechanism .................................................................................8 2.6 register file ......................................................................................................8 2.7 the stack pointer ............................................................................................10 2.8 the program counter ......................................................................................11 2.9 the link register ............................................................................................11 2.10 the status register .........................................................................................11 2.11 system registers ..............................................................................................14 2.12 recommended call convention ......................................................................26 3 java extension module ......... .............. .............. .............. .............. ........ 27 3.1 the avr32 java virtual machine ....................................................................27 4 secure state ........... .............. .............. ............... .............. .............. .......... 31 4.1 mechanisms implementing the secure state ..................................................31 4.2 secure state programming model ...................................................................32 4.3 details on secure state implementation .........................................................33 5 memory management unit ...... ................ ................. ................ ............. 35 5.1 memory map in systems with mmu .................................................................35 5.2 understanding the mmu ..................................................................................37 5.3 operation of the mmu and mmu exceptions ..................................................47 6 memory protection unit ..... .............. ............... .............. .............. .......... 51 6.1 memory map in systems with mpu .................................................................51 6.2 understanding the mpu ..................................................................................51 6.3 example of mpu functionality ..........................................................................55
ii 32000d?04/2011 avr32 7 performance counters ............. ................ ................. ................ ............. 57 7.1 overview ..........................................................................................................57 7.2 registers .........................................................................................................57 7.3 monitorable events ..........................................................................................59 7.4 usage ..............................................................................................................60 8 event processing ....... ................ ................. ................ ................. .......... 63 8.1 event handling in avr32a ..............................................................................63 8.2 event handling in avr32b ..............................................................................64 8.3 entry points for events .....................................................................................66 8.4 event priority ....................................................................................................92 8.5 event handling in secure state ........................................................................92 9 avr32 risc instruction set .... ................ ................. ................ ............. 93 9.1 instruction set nomenclature ..........................................................................93 9.2 instruction formats ..........................................................................................97 9.3 instruction set summary ...............................................................................106 9.4 base instruction set description ...................................................................122 10 revision history ....... ................ ................ ................. ................ ........... 373 10.1 rev. 32000a-02/2006 ....................................................................................373 10.2 rev. 32000b-11/2007 ....................................................................................373 10.3 rev. 32000c-08/2009 ...................................................................................373 10.4 rev. 32000d-04/2011 ...................................................................................373 table of contents ............. ................ ................. ................ .............. ........... i
32000d?04/2011 atmel corporation 2325 orchard parkway san jose, ca 95131 usa tel : (+1)(408) 441-0311 fax : (+1)(408) 487-2600 www.atmel.com atmel asia limited unit 1-5 & 16, 19/f bea tower, millennium city 5 418 kwun tong road kwun tong, kowloon hong kong tel : (+852) 2245-6100 fax : (+852) 2722-1369 atmel munich gmbh business campus parkring 4 d-85748 garching b. munich germany tel : (+49) 89-31970-0 fax : (+49) 89-3194621 atmel japan 9f, tonetsu shinkawa bldg. 1-24-8 shinkawa chuo-ku, tokyo 104-0033 japan tel : (+81)(3) 3523-3551 fax : (+81)(3) 3523-7581 ? 2011 atmel corporation. all rights reserved. / rev. corp072610 atmel ? , logo and combinations thereof, and others are registered trademarks or trademarks of atmel corporation or its subsidiaries. other terms and product names may be trademarks of others. disclaimer: the information in this document is provided in connection wi th atmel products. no license, ex press or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of atmel products. except as set forth in the atmel terms and conditions of sales located on the atmel website, atmel assumes no liability whatsoever and disclaims any express, implied or statutory warranty relating to its pro ducts including, but not limited to, the implied warranty of merchantability, fitness for a particular purp ose, or non-infringement. in no even t shall atmel be liable for any direct, indirect, consequential, punitive, special or incidental damages (including, without limitati on, damages for loss and prof- its, business interruption, or loss of information) arising out of the use or inability to use this document, even if atmel has been advised of the possibility of such damages. atmel makes no representations or warranties with respect to the accuracy or com- pleteness of the contents of th is document and reserves the right to make changes to specifications and product descriptions at any time without notice. atmel does not make any commitment to update the information cont ained herein. unless specifically provided otherwise, atmel pr oducts are not suit- able for, and shall not be used in, automotive applications. atme l products are not intended, authorized, or warranted for use as components in applica- tions intended to support or sustain life.


▲Up To Search▲   

 
Price & Availability of T89C51RD2-3CSIM

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X